How to close/hide the Android soft keyboard programmatically?

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 as the whatsapp keyboard, when touching outside the keyboard. I assume that this is a simple piece of code, but where can I find an example of it?

Añade tu respuesta

Haz clic para o