List of usage examples for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS
int HIDE_NOT_ALWAYS
To view the source code for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.
Click Source Link
From source file:Main.java
public static void hideSoftKeyPad(Context context, View view) { try {/*ww w. j av a2 s . c o m*/ if (view == null) { return; } else if (view.getWindowToken() == null) { return; } InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Throwable ex) { } }
From source file:Main.java
public static void minimizeKeyboard(Activity activity) { // Check if no view has focus: View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from ww w . j ava 2s . c o m*/ }
From source file:Main.java
public static void hideKeys(Context context, TextView textView) { textView.setCursorVisible(false);/*from ww w . jav a 2 s . co m*/ InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(textView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
/** * Hide input method.//from ww w . j av a2s . c o m * * @param activity */ public static void hideInputMethod(Activity activity) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); View currentFocus = activity.getCurrentFocus(); if (currentFocus != null) { imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
public static void showInputMethod(Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
public static void closeSoftKeyboard(Context context) { if (context == null || !(context instanceof Activity) || ((Activity) context).getCurrentFocus() == null) { return;//from w w w. j a v a 2s . co m } try { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void hiddenKeyboard(Class className, Context context, Activity activity) { try {// w w w.ja v a 2 s. c om InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (activity.getCurrentFocus() != null) { if (activity.getCurrentFocus().getWindowToken() != null) { imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Hides the keyboard//from ww w . j av a 2 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
/** * This method hides the keyboard//from ww w . ja va2 s . c o m * * @param activity * Active activity */ public static void hideKeyboard(Activity activity) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); View view = activity.getCurrentFocus(); if (view != null) { inputManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
/** * Force hide soft keyboard with flag : InputMethodManager.HIDE_NOT_ALWAYS. * @param context Context to get system service input method. * @param viewBinder View has current focus. Can achived by View.getWindowToken(). *//* w w w . jav a 2 s . c om*/ public static void hideKeyboard(Context context, View viewBinder) { InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(viewBinder.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }