Example usage for android.view.inputmethod InputMethodManager showSoftInput

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

Introduction

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

Prototype

public boolean showSoftInput(View view, int flags) 

Source Link

Document

Synonym for #showSoftInput(View,int,ResultReceiver) without a result receiver: explicitly request that the current input method's soft input area be shown to the user, if needed.

Usage

From source file:Main.java

public static void openSoftKeyboard(EditText et) {
    if (et != null) {
        et.setFocusable(true);/*from   ww w.  j  ava 2 s .  com*/
        et.setFocusableInTouchMode(true);
        et.requestFocus();
        InputMethodManager inputManager = (InputMethodManager) et.getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(et, 0);
    }
}

From source file:Main.java

public static void showKeyboard(View view) {
    if (view == null) {
        return;/* w ww  .  j av a 2s . co  m*/
    }
    InputMethodManager inputManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);

    ((InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view,
            0);
}

From source file:Main.java

public static boolean showSoftInput(Activity activity) {
    View view = activity.getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) view.getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        return imm.showSoftInput(view, 2);
    } else {/*from ww w.j  a  va2  s. c  o m*/
        return false;
    }
}

From source file:Main.java

public static void showSoftKeyboard(View view) {
    if (view == null)
        return;/*from   w w  w.  ja  v  a 2  s  .  c o m*/
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    if (!view.isFocused())
        view.requestFocus();

    InputMethodManager inputMethodManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(view, 0);
}

From source file:Main.java

/**
 * Explicitly request that the current input method's soft input area be
 * shown to the user, if needed./*from  w  w w  . j a  v a 2s  . c  o m*/
 * 
 * @param view
 *            The currently focused view, which would like to receive soft
 *            keyboard input.
 */
public static void showKeyboard(View view) {
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(view, InputMethodManager.RESULT_UNCHANGED_SHOWN);
}

From source file:Main.java

public static void showKeyboard(View view) {
    if (view == null) {
        return;//  www .j  a va2s  .  c  om
    }
    try {
        InputMethodManager inputManager = (InputMethodManager) view.getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static boolean showSoftInput(View view) {
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

public static void showSoftInputMethod(Context context, EditText editText) {
    if (context != null && editText != null) {
        editText.requestFocus();//from  w  w  w. ja v  a 2 s  .  c  o m
        InputMethodManager inputManager = (InputMethodManager) context
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(editText, 0);
    }
}

From source file:Main.java

public static void setKeyboardVisible(View view, boolean visible) {
    InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(INPUT_METHOD_SERVICE);
    if (visible) {
        imm.showSoftInput(view, 0);
    } else {/*from w  w  w  . j av  a  2s . c  o  m*/
        imm.hideSoftInputFromWindow(view.getWindowToken(), 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();//from   w  w w .  j  av  a  2  s . com
        imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
    } else {
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}