service - Trying to create a Android Soft Keyboard from an activity -
i wrote activity keyboard. moving class extends activity exteds inputmethodservice
... , missing findviewbyid
create keyboard layout. because have not enough knoledge create softkeyboard include java code. next step modify androidmanifest.xml service, guess.
package com.keyboard.mine; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.textview; public class mainactivity extends inputmethodservice /* activity */ { ... ... // @override // protected void oncreate(bundle savedinstancestate) { // super.oncreate(savedinstancestate); // setcontentview(r.layout.activity_main); // } // @override // public boolean oncreateoptionsmenu(menu menu) { // // inflate menu; adds items action bar if present. // getmenuinflater().inflate(r.menu.main, menu); // return true; // } private void nuevas_teclas (string [][] teclas_array) { button boton = (button) ***findviewbyid***(r.id.button00); boton.settext(teclas_array [pagina][0]); boton = (button) ***findviewbyid***(r.id.button01); boton.settext(teclas_array [pagina][1]); boton = (button) ***findviewbyid***(r.id.button02); boton.settext(teclas_array [pagina][2]); boton = (button) ***findviewbyid***(r.id.button10); boton.settext(teclas_array [pagina][4]); boton = (button) ***findviewbyid***(r.id.button11); boton.settext(teclas_array [pagina][5]); boton = (button) ***findviewbyid***(r.id.button12); boton.settext(teclas_array [pagina][6]); boton = (button) ***findviewbyid***(r.id.button20); boton.settext(teclas_array [pagina][8]); boton = (button) ***findviewbyid***(r.id.button21); boton.settext(teclas_array [pagina][9]); boton = (button) ***findviewbyid***(r.id.button22); boton.settext(teclas_array [pagina][10]); boton = (button) ***findviewbyid***(r.id.button31); if (! teclas_array [pagina][13].equals ("")) { boton.settext(teclas_array [pagina][13]); } boton = (button) ***findviewbyid***(r.id.buttonaux0); if (! teclas_array [pagina][3].equals ("")) { boton.settext(teclas_array [pagina][3]); } boton = (button) ***findviewbyid***(r.id.buttonaux1); if (! teclas_array [pagina][7].equals ("")) { boton.settext(teclas_array [pagina][7]); } boton = (button) ***findviewbyid***(r.id.buttonaux2); if (! teclas_array [pagina][11].equals ("")) { boton.settext(teclas_array [pagina][11]); } boton = (button) ***findviewbyid***(r.id.buttonaux3); if (! teclas_array [pagina][15].equals ("")) { boton.settext(teclas_array [pagina][15]); } boton = (button) ***findviewbyid***(r.id.buttonaux4); if (! teclas_array [pagina][14].equals ("")) { boton.settext(teclas_array [pagina][14]); } boton = (button) ***findviewbyid***(r.id.buttonaux5); if (! teclas_array [pagina][12].equals ("")) { boton.settext(teclas_array [pagina][12]); } } ... ... ... }
you can check following source codes available :
scandinavian-keyboard
hackers keyboard
android emoji keyboard
and try make on own.
hope helps , can basic idea.
Comments
Post a Comment