Android: automatically hides the soft keyboard

person Jason Huangfolder_openAndroid, Codelocal_offer, , , , access_time October 4, 2010

Sometimes it’s annoying that Android will pop up soft keyboard whenever it focuses on a EditText field, you can explicitly force hiding of soft keyboard by using this code:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>