Here you can find the source of hideKeyboard(View view)
public static void hideKeyboard(View view)
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; public class Main { public static void hideKeyboard(View view) { try {/* w ww . j a v a2s. co m*/ InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } catch (Exception e) { // couldn't close keyboards } } }