List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:Main.java
public static void hideKeyboard(Context context, View view) { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideKeyboard(Activity _activity, View _view) { InputMethodManager inputMethodManager = (InputMethodManager) _activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(_view.getWindowToken(), 0); }
From source file:Main.java
public static void closeInputMethodWindow(Activity activity) { try {// w w w. j a v a 2s.c o m InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Throwable e) { } }
From source file:Main.java
/** * Hides the keyboard//from w w w. j av a2 s .com * @param activity The activity currently active */ public static void hideKeyboardFromActivity(Activity activity) { View v = activity.getCurrentFocus(); if (v != null) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
public static void hideSoftKeyboard(Context context) { try {//w ww.jav a 2 s.c o m InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0); } catch (Exception ex) { } }
From source file:Main.java
public static void hideSoftInput(Context context) { View view = ((Activity) context).getWindow().peekDecorView(); if (view != null) { InputMethodManager inputmanger = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0); }// ww w .jav a2 s. c o m }
From source file:Main.java
private static void hideKeyboard() { // Check if no view has focus: View view = mainActivity.getCurrentFocus(); if (view != null) { InputMethodManager inputManager = (InputMethodManager) mainActivity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from www .j a v a 2s . co m*/ }
From source file:Main.java
public static void closeSoftKeyboard(View view) { if (view == null || view.getWindowToken() == null) { return;//from w w w .j ava 2 s . c o m } InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideInputKeyboard(Context context) { try {//from ww w.j a v a2 s .c om View view = ((Activity) context).getWindow().peekDecorView(); if (view != null && view.getWindowToken() != null) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void hideKeyboard(Activity activity, IBinder token) { try {/* w ww . j a v a 2 s .co m*/ InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(token, 0); } } catch (Exception e) { } }