androidonresume

show soft keyboard onResume


Couldn't find a clear answer to this one, basically I have an activity with an EditText field. The soft keyboard is set to visible within manifest, so keyboard is visible when activity starts however if user navigates away and returns using the back button the keyboard is hidden (I need it visible on resume). I have added the below method to my onResume but doesn't seem to work? Any ideas what I'm missing here?

private void showSoftKeyboard(){
    quickListName.requestFocus();
    InputMethodManager imm = D(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(quickListName,InputMethodManager.SHOW_IMPLICIT);
}

Solution

  • try this:

    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);