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:com.arlib.floatingsearchview.util.Util.java

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

    new Handler().postDelayed(new Runnable() {
        @Override/*w w 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_FORCED);
        }
    }, 100);
}

From source file:com.activiti.android.ui.utils.UIUtils.java

public static void showKeyboard(Activity activity, View v) {
    InputMethodManager mgr = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.showSoftInput(v, 0);
}

From source file:Main.java

public static void showInputMethod(Activity activity) {
    InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    View currentFocus = activity.getCurrentFocus();
    if (currentFocus != null) {
        imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        imm.showSoftInput(currentFocus, InputMethodManager.SHOW_IMPLICIT);
    }/* w w w  .ja  v a 2  s .  co  m*/

    //        if (imm != null) {
    //            imm.viewClicked(this);
    //        }
    //        if (imm != null && getShowSoftInputOnFocus()) {
    //            imm.showSoftInput(this, 0);
    //        }
}

From source file:org.alfresco.mobile.android.ui.utils.UIUtils.java

public static void showKeyboard(FragmentActivity activity, View v) {
    InputMethodManager mgr = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.showSoftInput(v, 0);
}

From source file:Main.java

public static void setSoftInputVisible(final View content, boolean visible, int delay) {
    final InputMethodManager imm = (InputMethodManager) content.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);

    if (visible) {
        if (delay > 0) {
            new Handler().postDelayed(new Runnable() {

                @Override/*from  w w  w.j ava 2  s .  c  o  m*/
                public void run() {
                    imm.showSoftInput(content, 0);
                }
            }, delay);
        } else {
            imm.showSoftInput(content, 0);
        }

    } else {
        if (delay > 0) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    imm.hideSoftInputFromWindow(content.getWindowToken(), 0);
                }
            }, delay);
        } else {
            imm.hideSoftInputFromWindow(content.getWindowToken(), 0);
        }

    }
}

From source file:com.jefftharris.passwdsafe.lib.view.GuiUtils.java

/**
 * Set the keyboard visibility on a view
 *//*w w  w .  j a  v  a  2  s . c o  m*/
public static void setKeyboardVisible(View v, Context ctx, boolean visible) {
    InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (visible) {
        if (ApiCompat.SDK_VERSION >= ApiCompat.SDK_HONEYCOMB) {
            imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
        } else {
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
        }
    } else {
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }
}

From source file:com.github.rutvijkumar.twittfuse.Util.java

public static void showSoftKeyboard(View view, Activity activity) {
    if (view.requestFocus()) {
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }/*from  w  w w.  ja v a 2s. c  o m*/
}

From source file:com.king.base.util.SystemUtils.java

/**
 * /*from   w w w  . j  a v a  2  s  .c om*/
 *
 * @param context
 * @param v
 */
public static void showInputMethod(Context context, EditText v) {
    v.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
}

From source file:io.github.mkjung.ivi.gui.helpers.UiTools.java

public static void setKeyboardVisibility(final View v, final boolean show) {
    final InputMethodManager inputMethodManager = (InputMethodManager) VLCApplication.getAppContext()
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    sHandler.post(new Runnable() {
        @Override// w  ww .jav  a  2 s . com
        public void run() {
            if (show)
                inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_FORCED);
            else
                inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
        }
    });
}

From source file:com.bt.download.android.gui.util.UIUtils.java

public static void showKeyboard(Context context, View view) {
    view.requestFocus();//w w  w . j  a  v a2  s .co m
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}