Mental Jetsam

By Peter Finch

Hiding the Android soft keyboard

Posted by pcfinch on July 19, 2012

This sounded so simple… but it wasn’t as easy as I thought. All I wanted to do was hide the soft keyboard when I was switching (using a ViewFlipper) to a view that did not require it. This is what I ended up doing and it seems to work.

ViewFlipper flipper = (ViewFlipper)this.findViewById(R.id.viewFlipper_main) ; // Any active view will do
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE) ;
imm.hideSoftInputFromWindow(flipper.getApplicationWindowToken(), 0);
flipper.setDisplayedChild(1) ;
Advertisements

One Response to “Hiding the Android soft keyboard”

  1. Way cool! Some extremely valid points! I appreciate you writing
    this write-up plus the rest of the site is
    extremely good.

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: