Example usage for android.content Context INPUT_METHOD_SERVICE

List of usage examples for android.content Context INPUT_METHOD_SERVICE

Introduction

In this page you can find the example usage for android.content Context INPUT_METHOD_SERVICE.

Prototype

String INPUT_METHOD_SERVICE

To view the source code for android.content Context INPUT_METHOD_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.view.inputmethod.InputMethodManager for accessing input methods.

Usage

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 popSoftkeyboard(Context ctx, View view, boolean wantPop) {
    InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (wantPop) {
        view.requestFocus();// w  w  w. j a v  a 2 s  .c  o  m
        imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
    } else {
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}

From source file:Main.java

public static void openSoftKeyboard(Context context, EditText editText) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    //        imm.showSoftInputFromInputMethod(editText.getWindowToken(), 0);
    imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

public static void closeKeybord(EditText mEditText, Context mContext) {
    InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

    imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
}

From source file:Main.java

public static String getLocale(final Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
    return ims == null ? "" : ims.getLocale();
}

From source file:Main.java

public static void hideInput(Activity context) {
    InputMethodManager mInputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    if (mInputMethodManager.isActive())
        mInputMethodManager.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), 0);
}

From source file:Main.java

public static void showKeyboard(EditText view) {
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    view.requestFocus();/*from   ww w . ja va  2 s.co  m*/
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}

From source file:Main.java

public static void hideKeyboardFromText(EditText editText, Context context) {
    InputMethodManager mgr = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}

From source file:Main.java

public static void showKeyboardFromText(EditText editText, Context context) {
    InputMethodManager mgr = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}

From source file:Main.java

public static void showInput(EditText editText) {
    InputMethodManager imm = (InputMethodManager) editText.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}