I am creating my own custom keyboard
and I am point the keyboard to the EditText
using etInputData.onCreateInputConnection(EditorInfo())!!
. In my layout
, I've used Custom TextView
and when user clicks on the TextView
, I use InputConnection
to commitText
but instead of concatenating the text and moving the cursor position, it replaces all text as shown in the following images:
Following is the commitText
code on user click
:
override fun onClick(v: View?) {
if (!::inputConnection.isInitialized) return
val value = (v as TextView).text.toString()
inputConnection.commitText(value, 1)
}