Android examples for android.view.inputmethod:InputMethodManager
hide Input Method
import android.app.Activity; import android.content.Context; import android.view.inputmethod.InputMethodManager; public class Main { public static void hideInputMethod(Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); }/*from w w w . ja v a 2s . co m*/ } public static void hideInputMethod(Activity activity) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); } } }