Is there any way I can force show Android's SoftKeyboard in NumberPassword mode without having an actual EditText in my activity?
I managed to show the keyboard when the activity starts by adding android:windowSoftInputMode="stateAlwaysVisible"
on my AndroidManifest.xml, make it impossible to close by overriding onKeyPreIme
in my CustomView
class that extends TextView
, and handling the touch events by myself by overriding onKeyUp
in my Activity.
If I add android:inputType="numberPassword"
directly in CustomView's XML Layout, Activity's onKeyUp gets bypassed and the keyboard write characters in my CustomView and KEYCODE_ENTER closes my keyboard.
What I want to achieve is:
- SoftKeyboard always out, both on Activity Start and Resume from the background
- Cannot be closed with KEYCODE_ENTER or KEYCODE_BACK
- 9-digit layout + Backspace
- Handle by myself key pressure to make it do something else instead of writing characters