I have an EditText
and I'd like my app to NEVER show the soft keyboard when I focus on it. I'm using an external keyboard.
I'd like to do this in my activity's onCreate
:
EditText debugPrompt = (EditText)findViewById(R.id.debug_prompt);
debugPrompt.setShowSoftInputOnFocus(false);
Problem is, I'm using SDK 19, and setShowSoftInputOnFocus
was added in 21. Is there any equivalent?
My best try so far is:
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
EditText debugPrompt = (EditText)findViewById(R.id.debug_prompt);
debugPrompt.requestFocus();
This does part of the job. The keyboard is hidden after line 4, but shows itself when I tap inside the EditText
.