Articles

How to close/hide the Android Soft Keyboard

In Android on September 26, 2011 by patrellery Tagged: ,


If you are like me, you might want to close or hide the soft keyword on your Android phone. After you are done writing in your layout using EditText, you want to close or hide the virtual Keyboard by clicking on a button (for example).

Well, stop searching for the solution. After digging here’s a little trick to fix this issue.

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

This ill force the keyboard to be hidden when you click on a button! easy and simple!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: