Example usage for android.view.inputmethod InputMethodManager hideSoftInputFromWindow

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

Introduction

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

Prototype

public boolean hideSoftInputFromWindow(IBinder windowToken, int flags) 

Source Link

Document

Synonym for #hideSoftInputFromWindow(IBinder,int,ResultReceiver) without a result: request to hide the soft input window from the context of the window that is currently accepting input.

Usage

From source file:Main.java

public static void hideKeyBoard(View view) {
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) view.getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }/* w ww. j a v a  2 s  . c  o  m*/
}

From source file:Main.java

public static void hideKeyboard(@NonNull View view) {
    InputMethodManager inputManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

From source file:Main.java

public static void KeyBoardCancle(Activity act) {

    View view = act.getWindow().peekDecorView();
    if (view != null) {

        InputMethodManager inputmanger = (InputMethodManager) act
                .getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }/*  w w w.  j a  v a  2 s .  c  om*/
}

From source file:Main.java

public static void hideSoftInput(Context context, EditText edit) {
    edit.clearFocus();/*from w w w.j a va 2  s.  com*/
    InputMethodManager inputmanger = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputmanger.hideSoftInputFromWindow(edit.getWindowToken(), 0);
}

From source file:Main.java

public static void hideSoftInput(View v, Context context) {
    final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }/* www  .  j av  a2  s  . co m*/
}

From source file:Main.java

/**
 * Hide keyboard//  w  w w.  j a va2  s  .com
 * 
 * @param activity
 */
public static void hideKeyboard(Activity activity) {

    InputMethodManager inputMethodManager = (InputMethodManager) activity
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
}

From source file:Main.java

public static void hideSoftKeyboard(Activity activity) {

    InputMethodManager inputMethodManager = (InputMethodManager) activity
            .getSystemService(Context.INPUT_METHOD_SERVICE);

    inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),
            InputMethodManager.HIDE_IMPLICIT_ONLY);
}

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 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  .  j a  va 2s  . co  m*/
}

From source file:Main.java

public static void closeWindowSoftKeyboard(View view) {
    InputMethodManager inputMethodManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);
}