List of usage examples for android.view.inputmethod InputMethodManager isActive
public boolean isActive()
From source file:Main.java
public static void hideKeyboard(View view) { if (view == null) { return;/* w ww . ja v a2 s . co m*/ } try { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (!imm.isActive()) { return; } imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void hideSoftKeyboard(Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); // imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); if (imm.isActive()) { imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); }/* ww w.j a v a 2s . co m*/ }
From source file:Main.java
/** * close the SoftInput/*from w w w .jav a 2 s. c o m*/ * * @param activity */ public static void closeSoftInput(Activity activity, EditText mEditText) { if (activity == null || mEditText == null) { return; } InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null && inputMethodManager.isActive()) { inputMethodManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); } }
From source file:Main.java
public static boolean isSoftInputActive(Activity activity, EditText mEditText) { if (activity == null) { return false; }// ww w . ja va2 s. 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 changeKeyBoard(Context context, EditText editText) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); editText.setFocusable(true);/*from w ww . j a v a 2s .co m*/ editText.setFocusableInTouchMode(true); editText.requestFocus(); if (imm.isActive()) { // imm.hideSoftInputFromWindow(getCurrentFocus() // .getWindowToken(), // InputMethodManager.HIDE_NOT_ALWAYS); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:com.atwal.wakeup.battery.util.Utilities.java
public static void hideSoftInput(InputMethodManager inputManager, View v) { if (inputManager.isActive()) { inputManager.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); }/*w w w . j a v a2s. co m*/ }
From source file:com.app.sample.chatting.widget.KJChatKeyboard.java
/** * ??// www . j ava 2s . c o m */ public void hideKeyboard(Context context) { Activity activity = (Activity) context; if (activity != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive() && activity.getCurrentFocus() != null) { imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); } } }
From source file:org.openlmis.core.view.activity.BaseActivity.java
public void hideImm() { InputMethodManager mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (mImm != null && mImm.isActive() && this.getCurrentFocus() != null) { mImm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0); }//from w w w .ja v a 2s. co m }
From source file:com.og.tracerouteping.ui.TraceActivity.java
/** * Hides the keyboard//w ww . j a va2 s . co m * * @param currentEditText * The current selected edittext */ public void hideSoftwareKeyboard(EditText currentEditText) { InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(currentEditText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
From source file:io.github.marktony.espresso.mvp.addpackage.AddPackageFragment.java
/** * Hide the input method like soft keyboard, etc... when they are active. *//*from w w w.j a va2 s . c o m*/ private void hideImm() { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(fab.getWindowToken(), 0); } }