Example usage for android.view.inputmethod InputMethodManager isActive

List of usage examples for android.view.inputmethod InputMethodManager isActive

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodManager isActive.

Prototype

public boolean isActive() 

Source Link

Document

Return true if any view is currently active in the input method.

Usage

From source file:Main.java

public static void showSoftInput(Context context, View focusView) {
    InputMethodManager imm = from(context);
    if (imm.isActive()) {
        imm.showSoftInput(focusView, InputMethodManager.SHOW_IMPLICIT);
    }// w  w w  .j  a  v  a 2s  .c  o  m
}

From source file:Main.java

public static void hideSoftInput(Context context, View focusView) {
    InputMethodManager imm = from(context);
    if (imm.isActive()) {
        IBinder token = focusView.getWindowToken();
        imm.hideSoftInputFromWindow(token, InputMethodManager.HIDE_NOT_ALWAYS);
    }/*from  w ww.  j  a v  a2  s  .  co m*/
}

From source file:Main.java

public static boolean isActive(Context context) {
    InputMethodManager imm = from(context);
    return imm.isActive();
}

From source file:Main.java

public static void closeBoard(Context mcontext) {
    InputMethodManager imm = (InputMethodManager) mcontext.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive())
        imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void shutInput(Context context, View view) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }//from www.j a va 2s  .c om
}

From source file:Main.java

public static void hitKeyboardOpenOrNot(Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
    }//  w  ww.j av  a 2s  .  c  o  m
}

From source file:Main.java

public static boolean isActiveSoftInput(Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    return imm.isActive();
}

From source file:Main.java

public static void delKeyBoard(Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
    }/*from   w  w w  . j  a  v  a 2  s .c o  m*/
}

From source file:Main.java

public static boolean isSoftInput(Activity activity) {
    InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    return imm.isActive();
}

From source file:Main.java

public static void hideIM(Context context, EditText et) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
        Log.i("Apputil", "--hide IM--");
    }//from  w  w w. j a  va 2  s.c o  m
}