Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
}
like image 592
GordonW Avatar asked Mar 17 '23 00:03

GordonW


1 Answers

try this:

imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
like image 186
Chahine Avatar answered Mar 29 '23 05:03

Chahine