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 openKeyboard(final Context context, final EditText editText) {
    new Handler().postDelayed(new Runnable() {
        @Override//from  ww  w .j  a va 2s  . c  o  m
        public void run() {
            editText.requestFocus();
            editText.setSelection(editText.getText().toString().length());
            InputMethodManager imm = (InputMethodManager) context
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
        }
    }, 300);
}

From source file:Main.java

public static void popSoftKeyboard(Context context, View view, boolean wantPop) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (wantPop) {
        view.requestFocus();//from   ww  w.ja  va2 s.c o m
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    } else {
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}

From source file:Main.java

/**
 * <pre>/*from w  w w .j  a v  a2  s . c om*/
 * Show keyboard, typically in an activity having {@link EditText}.
 * </pre>
 * @param focusedView typically an {@link EditText}
 */
public static void showKeyboard(View focusedView) {
    focusedView.requestFocus();
    InputMethodManager inputMethodManager = ((InputMethodManager) getCurrentContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE));
    inputMethodManager.showSoftInput(focusedView, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

public static void popSoftKeyboard(Context context, View view, boolean isShow) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (isShow) {
        view.requestFocus();/*from  ww  w  .  ja v  a 2s  .  c  o m*/
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    } else {
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}

From source file:Main.java

public static void showSoftKeyboard(View view) {
    Context context = view.getContext();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    view.requestFocus();//from  w  ww  .  j  av  a 2 s.c om
    if (imm != null) {
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }
}

From source file:Main.java

public static void showInputMethod(View view) {
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }/*from w  w  w .  j av  a 2s.com*/
}

From source file:Main.java

/**
 * Shows the soft keyboard//w  ww .  ja va 2  s.c o m
 */
public static void showKeyboardInActivity(Activity activity, View view) {
    InputMethodManager inputMethodManager = (InputMethodManager) activity
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    view.requestFocus();
    inputMethodManager.showSoftInput(view, 0);
}

From source file:Main.java

public static void showInputMethodManager(final EditText editText) {
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
        public void run() {
            InputMethodManager inputManager = (InputMethodManager) editText.getContext()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.showSoftInput(editText, 0);
        }//from  ww w  .  j  av a2  s .c  om
    }, 200);
}

From source file:Main.java

public static void showSoftInput(final Context context, final EditText et) {
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
        public void run() {
            InputMethodManager inputManager = (InputMethodManager) context
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.showSoftInput(et, 0);
        }//from w  ww  .  j  av a  2s.  c  o  m
    }, 998);
}

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, InputMethodManager.SHOW_FORCED);
    }//from w  w w. ja  va 2 s  .  c  o m
    return false;
}