I'm new to Android studio, curently I'm trying to build a custom keyboard within an app(Not Service Keyboard), I manage to done it by referring online resources, but when I try to switched from editText to TextView, my keyboard input just unable to write into the TextView, is there a different method for TextView?
I tried something like textView.setText(InputType.TYPE_CLASS_TEXT); The app just forced stop in this situation.
This is the editText that works fine.
EditText editText = (EditText) findViewById(R.id.editText);
myKeyboard keyboard = (myKeyboard) findViewById(R.id.keyboard);
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setTextIsSelectable(true);
InputConnection inputConnection = editText.onCreateInputConnection(newEditorInfo());
keyboard.setInputConnection(inputConnection);
Code below TextView has no respond while pressing on my keyboard.
TextView textView = (TextView) findViewById(R.id.textView);
myKeyboard keyboard = (myKeyboard) findViewById(R.id.keyboard);
textView.setRawInputType(InputType.TYPE_CLASS_TEXT);
textView.setTextIsSelectable(true);
This is the code that I have tried but app forced stopped.
TextView textView = (TextView) findViewById(R.id.textView);
myKeyboard keyboard = (myKeyboard) findViewById(R.id.keyboard);
textView.setText(InputType.TYPE_CLASS_TEXT);
For your information, the online resource that I referred to is at How to make an Android custom keyboard? Thanks in advance.