Android TextField : set focus + soft input programmatically

Good sir, try this:

edittext.setFocusableInTouchMode(true);
edittext.requestFocus();

I’m not sure, but this might be required on some phones (some of the older devices):

final InputMethodManager inputMethodManager = (InputMethodManager) context
                .getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(edittext, InputMethodManager.SHOW_IMPLICIT);

Leave a Comment