Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Context; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; public class Main { /** * Close keyboard */ public static void hideKeyboard(Context ctx, EditText edit) { InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edit.getWindowToken(), 0); } }