Example usage for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS

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

Introduction

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

Prototype

int HIDE_NOT_ALWAYS

To view the source code for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.

Click Source Link

Document

Flag for #hideSoftInputFromWindow and InputMethodService#requestShowSelf(int) to indicate that the soft input window should normally be hidden, unless it was originally shown with #SHOW_FORCED .

Usage

From source file:Main.java

@SuppressWarnings("static-access")
public static void hideSoftInput(Activity activity) {
    InputMethodManager imm = ((InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE));
    imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),
            InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hideSoftInput(EditText et) {
    InputMethodManager inputMethodManager = (InputMethodManager) et.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(et.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hideKeyoard(Activity activity) {
    InputMethodManager inputMethodManager = (InputMethodManager) activity
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),
            InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void colseSoftKeyboard(Activity activity) {
    InputMethodManager im = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    im.hideSoftInputFromWindow(activity.getCurrentFocus().getApplicationWindowToken(),
            InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hideSoftKeyborad(Activity context) {
    if (context == null)
        return;//from w w w  . j av  a2 s  .c om
    ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(
            context.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hidenInput(Activity ctx) {
    // TODO Auto-generated method stub

    InputMethodManager imm = ((InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE));

    imm.hideSoftInputFromWindow(ctx.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

}

From source file:Main.java

public static void showSoftInput(Activity activity) {
    InputMethodManager inputMethodManager = (InputMethodManager) activity
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}

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 w w .  j  ava 2 s.co m
}

From source file:Main.java

public static void closeKeyBoard(EditText editText, Context context) {
    InputMethodManager inputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hideKeyboard(Activity activity) {
    InputMethodManager m = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (m != null) {
        m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
    }/*  w  w  w . ja v a  2 s.c  o  m*/
}