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 hideKeyboard(Context c, View v) { if (v != null && c != null) { InputMethodManager imm = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); }/* w w w .ja va 2s.c om*/ }
From source file:Main.java
public static void showKeyboard(Context c, View v) { if (v != null && c != null) { InputMethodManager imm = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT); }// w w w . j av a2s. co m }
From source file:Main.java
public static void hideKeyboard(Context context, View editText) { try {/* w w w .j a v a2 s . c o m*/ InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (editText != null) { imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); editText.clearFocus(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
@SuppressLint("NewApi") public static void isHideKeyboard(View view, Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void showSoftKeyboard(View view) { Context context = view.getContext(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); view.requestFocus();/*from w ww . j av a 2 s .co m*/ imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); }
From source file:Main.java
public static void showKeyboard(View view) { if (view == null) { return;/*w ww .j a va 2 s . co m*/ } InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (!imm.isActive()) { return; } imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); }
From source file:Main.java
public static void openInputMethod(EditText editText) { InputMethodManager inputManager = (InputMethodManager) editText .getContext().getSystemService( Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(editText, 0); }
From source file:Main.java
public static void hideKeyboard(android.app.Activity _activity) { InputMethodManager inputManager = (InputMethodManager) _activity .getSystemService(Context.INPUT_METHOD_SERVICE); if (_activity.getCurrentFocus() != null) { inputManager.hideSoftInputFromWindow(_activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } else {/*from w w w . ja va2s . c o m*/ inputManager.hideSoftInputFromWindow(null, InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:Main.java
public static void hideKeyboard(FragmentActivity activity, View view) { // Hide Keyboard InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void showKeyboard(EditText editText) { editText.requestFocus();/*from w w w .java 2 s. co m*/ InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); } }