-1

I find a code on stackoverflow to create a keyboard but the problem is that the keyboard can write in a single edittext. I am looking for a solution how with this keyboard write in 9 edittext. here is the code stackoverflow How to make an Android custom keyboard? "In-App Keyboard"

here is the code that I use:

    a1=(EditText)findViewById(R.id.a1);
    a2=(EditText)findViewById(R.id.a2);
    a3=(EditText)findViewById(R.id.a3);
    b1=(EditText)findViewById(R.id.b1);
    b2=(EditText)findViewById(R.id.b2);
    b3=(EditText)findViewById(R.id.b3);
    c1=(EditText)findViewById(R.id.c1);
    c2=(EditText)findViewById(R.id.c2);
    c3=(EditText)findViewById(R.id.c3);
    MyKeyboard keyboard = (MyKeyboard) findViewById(R.id.keyboard);

    // prevent system keyboard from appearing when EditText is tapped
    a1.setRawInputType(InputType.TYPE_CLASS_TEXT);
    a1.setTextIsSelectable(true);

    // pass the InputConnection from the EditText to the keyboard
    InputConnection ic = a1.onCreateInputConnection(new EditorInfo());
    keyboard.setInputConnection(ic);

    // prevent system keyboard from appearing when EditText is tapped
    a2.setRawInputType(InputType.TYPE_CLASS_TEXT);
    a2.setTextIsSelectable(true);

    // pass the InputConnection from the EditText to the keyboard
    ic = a2.onCreateInputConnection(new EditorInfo());
    keyboard.setInputConnection(ic);

    // prevent system keyboard from appearing when EditText is tapped
    a3.setRawInputType(InputType.TYPE_CLASS_TEXT);
    a3.setTextIsSelectable(true);

    // pass the InputConnection from the EditText to the keyboard
    ic = a3.onCreateInputConnection(new EditorInfo());
    keyboard.setInputConnection(ic);
sorak
  • 2,607
  • 2
  • 16
  • 24
alz
  • 13
  • 3

1 Answers1

0

You can create a listener to know how key pressed and write it in all editText that you need.

If you see the link you can create a "OnKeyboardActionListener" and implement it

And then, in the "onKey" method you know the key pressed and now you can do with it that you want.

See the link shared to see how implement the listener.

JaFer
  • 213
  • 2
  • 10