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 hideSoftKeyboard(Context context, EditText editText) { // editText.setText(""); editText.clearFocus();/*from w w w. ja va 2 s.c o m*/ InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(editText.getWindowToken(), 0); }
From source file:Main.java
/** * Hides the keyboard./* w w w .j a v a 2 s . com*/ * * @param view */ public static void hideKeyboard(View view) { Context context = view.getContext(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideSoftKeyboard(Context context, View view) { if (context == null || view == null) { return;//from w w w .java 2 s . c o m } InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
public static void hideSoftKeyboard(Context context, View view) { if (null != context && null != view) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }/* ww w. j a v a 2s. c om*/ }
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 www . ja v a2s. c om*/ }
From source file:Main.java
public static void hideSoftInput(Activity activity) { View view = activity.getCurrentFocus(); if (view == null) view = new View(activity); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideSoftInput(Context context, View view) { if (view != null && view.getWindowToken() != null) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }/*w w w . jav a2 s. c om*/ }
From source file:Main.java
public static void hide(Activity activity) { View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }// w w w. j a v a 2s . com }
From source file:Main.java
/** * Magic to close the soft keyboard.//from w w w . j av a 2s . co m * * See http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard * * @param context The context. * @param focusedView The focused view. */ public static void closeSoftKeyboard(Context context, View focusedView) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(focusedView.getWindowToken(), 0); }
From source file:Main.java
public static void onInactive(Context context, EditText et) { if (et == null) return;//from www .j a va 2 s. c o m et.clearFocus(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(et.getWindowToken(), 0); }