Example usage for android.view.inputmethod InputMethodManager SHOW_IMPLICIT

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

Introduction

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

Prototype

int SHOW_IMPLICIT

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

Click Source Link

Document

Flag for #showSoftInput to indicate that this is an implicit request to show the input window, not as the result of a direct request by the user.

Usage

From source file:Main.java

public static void toggleKeyboard(Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
    }/*from  w w  w  .  ja va  2 s .c om*/
}

From source file:Main.java

public static void showKeyboard(Context context, View view) {
    InputMethodManager inputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    if (view.requestFocus()) {
        inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }/*from   w w  w .  jav a  2s . c om*/
}

From source file:Main.java

public static void showSoftKeyBroad(Context context, EditText editText) {
    InputMethodManager mgr = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    // only will trigger it if no physical keyboard is open
    mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}

From source file:Main.java

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

From source file:Main.java

private static void toggleSoftInput(Context context, View v, boolean hide) {
    if (context != null && v != null) {
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (hide)
            imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
        else/*from w  ww .j a v a2s .c  o  m*/
            imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
    }
}

From source file:Main.java

public static void hideIME(Activity context, boolean bHide) {
    if (bHide) {/*from  w ww .  j  a v  a2s  .c  o  m*/
        try {
            ((InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE))
                    .hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
        } catch (NullPointerException npe) {
            npe.printStackTrace();
        }
    } else { // show IME
        try {
            ((InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE))
                    .showSoftInput(context.getCurrentFocus(), InputMethodManager.SHOW_IMPLICIT);
        } catch (NullPointerException npe) {
            npe.printStackTrace();
        }
    }
}

From source file:com.mypopsy.widget.internal.ViewUtils.java

public static void showSoftKeyboardDelayed(final EditText editText, long delay) {
    editText.postDelayed(new Runnable() {
        @Override/*from  w ww .ja  v a  2  s  .c o  m*/
        public void run() {
            InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
        }
    }, delay);
}

From source file:com.tengio.util.Util.java

public static void showSoftKeyboard(final Context context, final EditText editText) {

    new Handler().postDelayed(new Runnable() {
        @Override/*from  ww w  .j  ava  2 s .  c o  m*/
        public void run() {

            InputMethodManager inputMethodManager = (InputMethodManager) context
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
        }
    }, 100);
}

From source file:me.panpf.tool4a.util.InputMethodUtils.java

/**
 * ????/*from w  w w  . j  a  va2 s. c o  m*/
 *
 * @param editText        
 * @param moveCursorToEnd ??
 */
@SuppressWarnings("WeakerAccess")
public static void showSoftInput(EditText editText, boolean moveCursorToEnd) {
    // ?
    editText.requestFocus();

    InputMethodManager imm = (InputMethodManager) editText.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);

    // ??
    if (moveCursorToEnd) {
        moveCursorToEnd(editText);
    }
}

From source file:com.justplay1.shoppist.utils.ViewUtils.java

public static void showSoftKeyboardDelayed(final EditText editText, long delay) {
    editText.postDelayed(() -> {/*from ww w  .j  a va2  s  .  c om*/
        InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
    }, delay);
}