Hide Soft Keyboard
<p>I need to be able to hide the soft keyboard in response to clicking a button.  I have seen numerous posts on this subject and it seems that the solution is to use the <code>InputMethodManager</code>, but I have been unable to get it to work for me.  Supposedly the following will hide the soft keyboard:</p>

<pre><code>  InputMethodManager inputManager = (InputMethodManager) 
         getSystemService(INPUT_METHOD_SERVICE);

  inputManager.hideSoftInputFromInputMethod(editView.getWindowToken(), 0);
</code></pre>

<p>However, this is not working for me (can any suggest why?), and even if it did, I want to be able to hide the keyboard regardless of what view has the input, and I may not know what view that is.</p>

<p>I found that the call:</p>

<pre><code>inputManager.toggleSoftInput(0, 0);
</code></pre>

<p>will hide the keyboard if it is currently being shown.  Unfortunately it will also show it if it is currently hidden.  So for this to work for me, I would need a way to determine whether it is currently visible.</p>

<p>Any ideas?</p>

<p>Thanks</p>
