I have a simple InputMethodService implementation:
class MyKeyboardView : InputMethodService() {
override fun onCreate() {
super.onCreate()
Timber.d("onCreate")
}
// Also tried the default implementation
override fun onShowInputRequested(flags: Int, configChange: Boolean): Boolean {
Timber.d("onShowInputRequested")
return true
}
override fun onCreateInputView(): View {
Timber.d("onCreateInputView")
return KeyboardView(this)
}
private class KeyboardView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
init {
Timber.d("Init")
}
}
}
Input method is selected as current one.
Other methods like onCreate, onShowInputRequested, onStartInputView are called, but not onCreateInputView.
onCreateInputView is never called. Why?
From
onStartInputView's doc:So if you're seeing debug logs from this method, the create method must be called.
Try to override
onEvaluateInputViewShowntoo and return true.