List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:Main.java
/** * Dismisses the soft keyboard if it's present on the screen, otherwise this call is silent. * * @param context/* ww w. j a v a2 s.c om*/ * @param editText the EditText that the soft keyboard is "attached" to */ public static void closeSoftKeyboard(Context context, EditText editText) { InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(editText.getWindowToken(), 0); }
From source file:Main.java
public static void hideKeyboard(Context context, IBinder token) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(token, 0); }
From source file:Main.java
public static void hideKeyboard(Activity activity) { // hide keyboard if it's open View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }//from w w w . j a v a 2 s . c om }
From source file:Main.java
public static void forceHideKeyboard(Context context, IBinder iBinder) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(iBinder, 0); }
From source file:Main.java
public static void closeInputMethod(final Activity activity, final View view) { final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
/***************************************************** * ---------------- * Soft keyboard * -------------------- * * * ****************************************************/ public static void hideKeyboard(Activity activity) { if (activity != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0); }// w w w .jav a 2 s.c om }
From source file:Main.java
public static void closeInput(Activity context) { try {// w w w. j av a2 s . c om InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), 0); } catch (Exception e) { } }
From source file:Main.java
public static final void HideSoftKeyboard(View view, Context context) { if (view == null || context == null) return;//w w w . j a va2s. c o m InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); imm = null; }
From source file:Main.java
public static void hideKeyboard(Context context, View view) { if (view != null) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }//from ww w .j a va 2s . co m }
From source file:Main.java
public static void HideIme(Activity activity) { if (activity.getCurrentFocus() != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }//from w ww.j av a 2s. co m }