Android examples for android.view.inputmethod:InputMethodManager
hide Keyboard for view Responsible For Keyboard
import android.app.Activity; import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; public class Main{ public static void hideKeyboard(Activity activity, View viewResponsibleForKeyboard) { InputMethodManager imm = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(/*from w w w . j a v a 2 s . c o m*/ viewResponsibleForKeyboard.getApplicationWindowToken(), 0); } }