List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:Main.java
/** * close the SoftInput//w ww . j a va 2s . co m * * @param activity */ public static void closeSoftInput(Activity activity, EditText mEditText) { if (activity == null || mEditText == null) { return; } InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null && inputMethodManager.isActive()) { inputMethodManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); } }
From source file:Main.java
public static void closeSoftKeyboard(Context context) { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null && ((Activity) context).getCurrentFocus() != null) { inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from ww w . ja v a2 s . c o m*/ }
From source file:Main.java
public static void closeSoftInput(Context context) { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); if ((inputMethodManager != null) && (((Activity) context).getCurrentFocus() != null)) inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 2); }
From source file:Main.java
public static void hidekeyboard(Activity act) { InputMethodManager imm = ((InputMethodManager) act.getSystemService(Activity.INPUT_METHOD_SERVICE)); if (imm.isActive()) { View focusView = act.getCurrentFocus(); if (focusView != null) { imm.hideSoftInputFromWindow(focusView.getWindowToken(), 0); }/* w ww . ja v a2 s .com*/ } }
From source file:Main.java
public static void hideSoftKeyboard(Activity activity) { if (activity != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE); View view = activity.getCurrentFocus(); if (view != null) inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }/*from w w w . j a va2s. com*/ }
From source file:com.arlib.floatingsearchview.util.Util.java
public static void closeSoftKeyboard(Activity activity) { View currentFocusView = activity.getCurrentFocus(); if (currentFocusView != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0); }//from w w w.ja v a 2s . c o m }
From source file:Main.java
public static void hideKeyboard(Activity activity) { if (activity != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { View v = activity.getCurrentFocus(); if (v != null) imm.hideSoftInputFromWindow(v.getWindowToken(), 0); }// w w w .j a va 2 s .co m } }
From source file:Main.java
public static void popSoftkeyboard(Context ctx, View view, boolean wantPop) { InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); if (wantPop) { view.requestFocus();// www . j a v a2s. c o m imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); } else { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }
From source file:Main.java
/** * Hides the soft keyboard/*w ww. j a v a 2 s . c o m*/ * * @param activity The reference of the activity displaying the keyboard */ public static void hide(@NonNull final Activity activity) { final InputMethodManager iManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); final View view = activity.getCurrentFocus(); if (view != null && iManager != null) { iManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } }
From source file:Main.java
public static void hideSoftInputView(Activity activity) { if (activity.getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { InputMethodManager manager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); View currentFocus = activity.getCurrentFocus(); if (currentFocus != null) { manager.hideSoftInputFromWindow(currentFocus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from w w w . ja v a 2 s. co m*/ } }