Saturday, 23 November 2019

Software Keyboard doesn't appear the first time the fragment is loaded

I've been trying to automatically show the keyboard with focus on a edit text when a fragment(that includes the edittext) is loaded.

I've tried using :

     editTextPrice.requestFocus();
    InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imgr.showSoftInput(getView(), InputMethodManager.SHOW_IMPLICIT);

But this doesn't work the first time I load the fragment. The focus is set and I can see the cursor but no keyboard appears. If I close the fragment and add it again it works.

If tried everything from post() to a postpone it with a handler, to onResume,ect.

Does anybody have an idea what might cause this to happen?

Thanks in advance.

Best regards



from Software Keyboard doesn't appear the first time the fragment is loaded

No comments:

Post a Comment