Skip to content Skip to sidebar Skip to footer

Edittext Steals Focus

I have an Activity, which has an EditText and a ListView. The EditText can be used to filter listview rows. problem is that when the Activity loads up, the keyboard popups by defau

Solution 1:

I've had this problem myself, its really annoying. You need to tell the system to hide the Soft Keyboard. The Android documentation says this, "Flag for hideSoftInputFromWindow(IBinder, int) to indicate that the soft input window should only be hidden if it was not explicitly shown by the user."

InputMethodManagerimm= (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);

Solution 2:

In the manifest, put the following for your activity :

android:windowSoftInputMode="stateHidden"

Post a Comment for "Edittext Steals Focus"