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 showKeyboard(Activity activity, View view) {
    if (activity != null) {
        if (view != null) {
            view.requestFocus();/*www.ja v a  2 s . c  o m*/
        }
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
        }
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.CUPCAKE)
public static void toggleSoftInput(Context context, EditText edit) {
    edit.setFocusable(true);/*  w w  w .j a v a2 s .  co  m*/
    edit.setFocusableInTouchMode(true);
    edit.requestFocus();
    InputMethodManager inputManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}

From source file:Main.java

/**
 * <pre>//from  ww  w .  j a  v a  2 s .c  o m
 * 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

/**
 * Force show soft keyboard with show flag = InputMethodManager.SHOW_FORCED and hide flag = 0.
 * @param context Context to get system service input method.
 * @param viewBinder View has current focus.
 *///from   w w  w.ja  v  a 2 s .c o  m
public static void forceShowSoftInput(Context context, View view) {
    if (view != null) {
        view.requestFocus();
    }
    InputMethodManager inputManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); //Hide Flag = 0
}

From source file:Main.java

public static void showKeyboard(Activity activity) {
    getInputMethodManager(activity).toggleSoftInput(InputMethodManager.SHOW_FORCED,
            InputMethodManager.HIDE_IMPLICIT_ONLY);
}

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 openKeyboard(final Context context, final EditText editText) {
    new Handler().postDelayed(new Runnable() {
        @Override/*from www .j  ava 2 s  . 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 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  .j  a va2 s  .  com*/
    return false;
}

From source file:org.transdroid.core.gui.FilterEntryDialog.java

/**
 * Opens a dialog that allows entry of a filter string, which (on confirmation) will be used to filter the list of 
 * torrents./*from w  w  w .  java 2 s .c o  m*/
 * @param activity The activity that opens (and owns) this dialog
 */
@SuppressLint("ValidFragment")
public static void startFilterEntry(final TorrentsActivity activity) {
    new DialogFragment() {
        public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState) {
            final EditText filterInput = new EditText(activity);
            filterInput.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
            ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE))
                    .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            return new AlertDialog.Builder(activity).setView(filterInput)
                    .setPositiveButton(android.R.string.ok, new OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            String filterText = filterInput.getText().toString();
                            if (activity != null)
                                activity.filterTorrents(filterText);
                        }
                    }).setNegativeButton(android.R.string.cancel, null).create();
        };
    }.show(activity.getSupportFragmentManager(), "filterentry");
}

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//www  .  ja  v  a 2 s .c om
        public void run() {

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