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 onInactive(Context context, EditText et) { if (et == null) return;//from w ww . j ava 2 s . co m et.clearFocus(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(et.getWindowToken(), 0); }
From source file:Main.java
public static void showSoftKey(EditText et) { et.setFocusable(true);// w ww.j a v a 2 s. c o m et.setFocusableInTouchMode(true); et.requestFocus(); InputMethodManager inputManager = (InputMethodManager) et.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(et, 0); }
From source file:Main.java
public static boolean isSoftInputActive(Activity activity, EditText mEditText) { if (activity == null) { return false; }/* w w w .j a v a 2s. c om*/ InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); // imm.showSoftInput(mEditText, InputMethodManager.SHOW_FORCED); if (imm != null) { return imm.isActive(); } return false; }
From source file:Main.java
public static void showKeyboard(Context ctx, EditText editText) { editText.setFocusable(true);//w ww. j av a2 s. com editText.setFocusableInTouchMode(true); editText.requestFocus(); InputMethodManager inputManager = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(editText, 0); }
From source file:Main.java
/** * Hides the keyboard./*from w ww . ja v a 2 s. c om*/ * * @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 setSoftInputVisible(final View content, boolean visible, int delay) { final InputMethodManager imm = (InputMethodManager) content.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { if (delay > 0) { new Handler().postDelayed(new Runnable() { @Override//from w ww.j a va2 s. co m public void run() { imm.showSoftInput(content, 0); } }, delay); } else { imm.showSoftInput(content, 0); } } else { if (delay > 0) { new Handler().postDelayed(new Runnable() { @Override public void run() { imm.hideSoftInputFromWindow(content.getWindowToken(), 0); } }, delay); } else { imm.hideSoftInputFromWindow(content.getWindowToken(), 0); } } }
From source file:Main.java
/** * Shows the keyboard.//from w ww . j av a 2s .c om * * @param view */ public static void showKeyboard(View view) { Context context = view.getContext(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }
From source file:Main.java
public static void showSoftInput(Activity acitivity, EditText et) { if (et == null) return;//from w ww . j ava 2 s . co m et.requestFocus(); InputMethodManager imm = (InputMethodManager) et.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(et, InputMethodManager.RESULT_UNCHANGED_SHOWN); }
From source file:Main.java
public static void hideKeyboard(Activity activity) { if (activity != null && activity.getCurrentFocus() != null) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/* w w w. ja v a2 s . c om*/ }
From source file:Main.java
public static void showSoftInput(Context context, EditText edit) { edit.setFocusable(true);//from w w w . jav a 2s . co m edit.setFocusableInTouchMode(true); edit.requestFocus(); InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(edit, 0); }