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 openSoftKeyboard(EditText et) { if (et != null) { et.setFocusable(true);//from w ww. j av a 2 s . c om et.setFocusableInTouchMode(true); et.requestFocus(); InputMethodManager inputManager = (InputMethodManager) et.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(et, 0); } }
From source file:Main.java
/** Show soft keyboard when editText is focused * * @param activity//from w w w . j av a 2 s . c o m * @param edit_text */ public static void showSoftKeyboard(Activity activity, EditText edit_text) { imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(edit_text, InputMethodManager.SHOW_IMPLICIT); }
From source file:Main.java
public static void hideInput(Activity activity) { View view = activity.getWindow().peekDecorView(); if (view != null) { InputMethodManager inputmanger = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0); }/*w ww. j ava2 s . c om*/ }
From source file:Main.java
public static void closeKeyboard(Activity activity) { View view = activity.getWindow().peekDecorView(); if (view != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }/* w w w . ja v a 2 s.co m*/ }
From source file:Main.java
public static void hideKeyboard(Activity activity) { // hide keyboard if it's open View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }/*from w ww . ja va 2 s. c om*/ }
From source file:Main.java
public static void hideSoftKeyboard(Context context, View view) { // Hide soft keyboard if keyboard is up if (isKeyboardShown(view.getRootView())) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }//w ww .j av a 2 s . c om }
From source file:Main.java
public static void showKeys(Context context, TextView textView) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(textView, InputMethodManager.SHOW_IMPLICIT); }
From source file:Main.java
public static void hideSoftInput(Context context) { View view = ((Activity) context).getWindow().peekDecorView(); if (view != null) { InputMethodManager inputmanger = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0); }//from w w w . j a va 2 s . com }
From source file:Main.java
public static void showKeyboard(Activity activity, View view) { if (activity != null) { if (view != null) { view.requestFocus();/*from w w w . ja v a2s. c o m*/ } InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } } }
From source file:Main.java
/** * get the SoftInput state// ww w.j a v a2 s .c o m * * @param activity * @return if shown return true else return false */ public static boolean softInputIsShow(Activity activity) { if (activity == null) { return false; } InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); return imm.isActive(); }