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 hideSoftKeyboard(Context context) { try {/*from ww w . j a v a 2 s .co m*/ InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0); } catch (Exception ex) { } }
From source file:Main.java
public static void hiddenKeyboard(Class className, Context context, Activity activity) { try {/*from w w w . j a v a 2 s . c o m*/ InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (activity.getCurrentFocus() != null) { if (activity.getCurrentFocus().getWindowToken() != null) { imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void hideInput(Context context, View view) { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideSoftKeyboard(Activity activity) { View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }// w ww . j a v a 2 s . co m }
From source file:Main.java
public static void show(Activity activity, EditText editText) { editText.requestFocus();// w w w .ja v a 2 s. c om editText.requestFocusFromTouch(); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); }
From source file:Main.java
/** * @Description://from ww w. ja v a 2 s . c om * @param addNoteActivity */ public static void forceShowKeyboard(Context context, EditText edt) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInputFromInputMethod(edt.getWindowToken(), InputMethodManager.SHOW_FORCED); }
From source file:Main.java
public static void hideSoftInputMethod(View view) { Context context = view.getContext(); InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideKeyboard(Context context) { View view = ((Activity) context).getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }//from www .j av a2 s . c o m }
From source file:Main.java
public static void hideKeyboard(@NonNull View view) { InputMethodManager inputManager = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
/** * Show always Soft Keyboard// w w w . java 2 s. c o m * * @param context is current Activity */ public static void showKeyboard(Context context, EditText editText) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (editText != null) { imm.showSoftInput(editText, 0); } }