Skip to content Skip to sidebar Skip to footer

Why Doesn't The Softkeyboard Open When I Tap An Edittext Inside A Viewpager?

Like the title says, I've got a viewPager with some editText fields inside. I can select the editText fields perfectly fine (emulator and physical device). I see the cursor, and I

Solution 1:

Finally bumped in to an answer that's working for me, which can be found here.


Basically, if you're using the onCreateDialog() method, you leave that as is, and add the onResume() method below to your DialogFragment's java file.

@OverridepublicvoidonResume() {
    super.onResume();
    Dialogdialog= getDialog();
    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

Solution 2:

You can force softKeyboard with this code:

EditText yourEditText= (EditText) findViewById(R.id.yourEditText);
InputMethodManagerimm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT);

Post a Comment for "Why Doesn't The Softkeyboard Open When I Tap An Edittext Inside A Viewpager?"