List of usage examples for android.content Context INPUT_METHOD_SERVICE
String INPUT_METHOD_SERVICE
To view the source code for android.content Context INPUT_METHOD_SERVICE.
Click Source Link
From source file:Main.java
public static void closeInput(Activity context) { try {/*from w w w. ja va 2 s . c o m*/ 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 void showSoftKeyboard(Context context, EditText editText) { if (editText.requestFocus()) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); }/*from w ww. j a v a2 s.c o m*/ }
From source file:Main.java
/** * Force show softKeyboard.// w w w. jav a2 s. c om */ public static void forceShow(@NonNull Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:Main.java
public static void hideSoftKeyboard(Context context, View inputView) { if (inputView == null) return;/*from w w w . j a va2s .c om*/ InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(inputView.getWindowToken(), 0); }
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); }//from w ww . j av a 2 s . c om } }
From source file:Main.java
public static void closeInputMethodWindow(Activity activity) { try {/*from w w w. j a v a2s .co m*/ InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Throwable e) { } }
From source file:Main.java
public static void hideKeyboard(Activity activity) { InputMethodManager m = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (m != null) { m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); }//from www. ja v a2 s . c o m }
From source file:Main.java
public static void popSoftKeyboard(Context context, View view, boolean isShow) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (isShow) { view.requestFocus();//w w w . j a v a 2 s . c o m imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } else { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }
From source file:Main.java
public static void hideSoftInput(Context context, View view) { if (view != null) { InputMethodManager inputmanger = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0); }/* ww w.ja v a2 s .c om*/ }
From source file:Main.java
public static void hideKeyboard(Activity activity, IBinder token) { try {// w w w. j av a2 s.co m InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(token, 0); } } catch (Exception e) { } }