Example usage for android.view View requestFocus

List of usage examples for android.view View requestFocus

Introduction

In this page you can find the example usage for android.view View requestFocus.

Prototype

public final boolean requestFocus() 

Source Link

Document

Call this to try to give focus to a specific view or to one of its descendants.

Usage

From source file:Main.java

public static void getFocus(View view) {
    view.requestFocus();
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
}

From source file:Main.java

public static void showKeyboard(Context context, View v) {
    v.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(v, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

public static void showKeyBoard(Context context, View view) {
    view.requestFocus();
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:Main.java

public static void showSoftInput(Activity activity, View editText) {
    editText.requestFocus();
    InputMethodManager imm = ((InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE));
    imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
}

From source file:Main.java

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

From source file:Main.java

public static void showKeyboard(View view) {
    view.requestFocus();
    InputMethodManager inputManager = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.showSoftInput(view, 0);
}

From source file:Main.java

public static void hideKeyboard(Context context, View view) {
    view.requestFocus();
    imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:Main.java

/**
 * <pre>//from   w  w w  .j  av a2s. 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

/**
 * Explicitly request that the current input method's soft input area be
 * shown to the user, if needed./*from w  w  w  .  ja v  a  2  s. com*/
 * 
 * @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

private static void focusNothing(View rootView) {
    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
}