I just wanted to share two ways about hiding your soft keyboard. When i was making a screen for submitting score to leaderboards, when i touch edittext to enter my name soft keyboard appears and when i click submit button i wanted that soft keyboard to disappear so i found this one way to do that:

InputMethodManager inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(Test.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

Now for second issue that i faced, i had a AutoCompleteTextView on my one application activity so whenever that activity takes screen a soft keyboard appears with focus on autocomplete obviously. This thing didn’t happened with EditText. But whenever i had autocompletetextview soft keyboard appears automatically. I didn’t wanted this. Instead i wanted soft keyboard to appear only when i touch AutoCompleteTextView. But i found a simple solution for this:


yeah just add android:windowSoftInputMode=”stateAlwaysHidden” attribute to activity tag, so whenever my activity takes screen keyboard will not show up until i touch any editable view. This has worked for me till now, so you can give it a try.