I have an EditText and a Button in my layout. After writing in the edit field and clicking on the Button , I want to hide the virtual keyboard. I assume that this is a simple piece of code, but where can I find an example of it? Correct: To help clarify this madness, I'd like to begin by apologizing on behalf of all Android users for Google's downright ridiculous treatment of the soft keyboard. The reason there are so many answers, each different, for the same simple question because this API, like many others in Android, is horribly designed. I can think of no polite way to state it. I want to hide the keyboard. I expect to provide Android with the following statement: Keyboard.hide() . The end. Thank you very much. But Android has a problem. You must use the InputMethodManager to hide the keyboard. OK, fine, this is Android's API to the keyboard. BUT! You are required to have a Context in order to get access...