Example usage for android.view.inputmethod InputMethodManager SHOW_FORCED

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

Introduction

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

Prototype

int SHOW_FORCED

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

Click Source Link

Document

Flag for #showSoftInput to indicate that the user has forced the input method open (such as by long-pressing menu) so it should not be closed until they explicitly do so.

Usage

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 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 showKeyboard(Context context, View view) {
    try {//  ww w  . j av a2 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:Main.java

public static void showSoftInput(Context context, final EditText et) {
    if (context == null || et == null) {
        return;//  w  ww .ja  va 2 s. com
    }
    InputMethodManager imm = (InputMethodManager) et.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);

    imm.showSoftInput(et, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

/**
 * Shows the keyboard./*  w w w . j  ava  2s  .  c om*/
 * 
 * @param view
 */
public static void showKeyboard(View view) {
    Context context = view.getContext();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:Main.java

public static void showSoftKeyborad(Activity context, EditText et) {
    if (context == null)
        return;//from ww w .j  a v  a  2  s  .  c  om
    InputMethodManager inputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(et, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

/**
 * @Description:/*ww w  .jav a  2s  .com*/
 * @param addNoteActivity
 */
public static void forceShowKeyboard(Context context, EditText edt) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInputFromInputMethod(edt.getWindowToken(), InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

public static void showSoftKeyBoard(Context context, View... views) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (views != null) {
        for (View view : views) {
            if (view != null) {
                imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
            }/*from   w  w w . j ava 2 s.  c  o m*/
        }
    }
}

From source file:Main.java

public static void hideSoftKeyboard(Context context, View view) {
    // Hide soft keyboard if keyboard is up
    if (isKeyboardShown(view.getRootView())) {
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }/*from  ww w  .  j av a  2s.c  o  m*/
}

From source file:Main.java

public static void showInputKeyboard(Context context) {
    try {/*from   ww  w . j a  v a 2  s.c o m*/
        View view = ((Activity) context).getWindow().peekDecorView();
        if (view != null && view.getWindowToken() != null) {
            InputMethodManager imm = (InputMethodManager) context
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
            imm.showSoftInput(view, 0);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}