Example usage for android.view View getApplicationWindowToken

List of usage examples for android.view View getApplicationWindowToken

Introduction

In this page you can find the example usage for android.view View getApplicationWindowToken.

Prototype

public IBinder getApplicationWindowToken() 

Source Link

Document

Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to.

Usage

From source file:Main.java

public static void hideKeyboard(Context context, View view) {
    view.requestFocus();//from   w  w  w  . j a v a  2s  . c o m
    imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

public static void hideInputMethod(View v) {
    InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
    }//from ww  w  .  j a  v  a  2s .c  om
}

From source file:Main.java

public static void HideKeyboard(View v) {
    InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
    }/*from  www . j a v a  2s.  c o  m*/
}

From source file:Main.java

static public void hideKeyboard(Context a, View v) { //edittext or tabhost or whatever
    ((InputMethodManager) a.getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(
            //v.getWindowToken()
            v.getApplicationWindowToken(), 0);
}

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);
}

From source file:Main.java

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

From source file:Main.java

public static void hiddenKeyBoard(View view) {
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive())
        imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);
}

From source file:Main.java

public static void showKeyboard(Context context, View view) {
    try {/*from   w ww .  j av a  2  s . c  o m*/
        InputMethodManager inputManager = (InputMethodManager) context
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.toggleSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED,
                0);
        view.requestFocus();
    } catch (Exception ex) {
    }
}

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);
    }/*from ww  w . j  a  va  2s .  co m*/
}

From source file:pro.dbro.bart.TheActivity.java

public static void hideSoftKeyboard(View view) {
    InputMethodManager imm = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);
}