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 changeKeyBoard(Context context, EditText editText) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); editText.setFocusable(true);/*from w w w . j a v a 2 s. c o m*/ editText.setFocusableInTouchMode(true); editText.requestFocus(); if (imm.isActive()) { // imm.hideSoftInputFromWindow(getCurrentFocus() // .getWindowToken(), // InputMethodManager.HIDE_NOT_ALWAYS); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
/** * Hide soft key board./*from w w w. j a v a 2 s .com*/ * * @param activity the activity */ public static void hideSoftKeyBoard(Activity activity) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); View currentFocus = activity.getCurrentFocus(); if (currentFocus != null) { IBinder windowToken = currentFocus.getWindowToken(); inputManager.hideSoftInputFromWindow(windowToken, InputMethodManager.HIDE_NOT_ALWAYS); } else { activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } }
From source file:Main.java
public static void hideSoftInput(Activity activity) { View currentFocus = activity.getCurrentFocus(); if (currentFocus != null) { IBinder windowToken = currentFocus.getWindowToken(); if (windowToken != null) { InputMethodManager manager = (InputMethodManager) (activity .getSystemService(Context.INPUT_METHOD_SERVICE)); if (manager != null) { manager.hideSoftInputFromWindow(windowToken, InputMethodManager.HIDE_NOT_ALWAYS); }// ww w .j a v a 2 s. com } } }
From source file:Main.java
public static void hideKeyboard(Activity activity) { imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
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 www . j a v a2s .c om*/ } }
From source file:Main.java
public static void hideInput(Activity activity) { if (activity != null && activity.getCurrentFocus() != null) { ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }// www . j a v a 2 s. co m }
From source file:Main.java
public static void hideSoftKeyboard(View view) { if (view == null) return;/*from ww w .j ava 2 s . c o m*/ View mFocusView = view; Context context = view.getContext(); if (context != null && context instanceof Activity) { Activity activity = ((Activity) context); mFocusView = activity.getCurrentFocus(); } if (mFocusView == null) return; mFocusView.clearFocus(); InputMethodManager manager = (InputMethodManager) mFocusView.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(mFocusView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
/** * Request to hide the soft input window from the context of the window that * is currently accepting input.// w ww .j av a 2s. com * * @param activity * The currently activity, which shows the view receives soft * keyboard input. */ public static void hideKeyboard(Activity activity) { if (null == activity) { return; } InputMethodManager im = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); View v = activity.getCurrentFocus(); if (v != null) { im.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
public static void hideKeyBoard(Activity aty) { ((InputMethodManager) aty.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( aty.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:com.polatic.pantaudki.utils.UIUtils.java
/** * Hide keyboard//from w w w. ja va 2s . c o m * @param mContext * @param activity */ public static void hideKeyboard(Context mContext, Window window) { InputMethodManager inputManager = (InputMethodManager) mContext .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(window.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }