I added a navigation box to the application. So far, everything is working well, but I have a problem when the keyboard is not closed when opening the navigation box. The core of navigation is the main activity, and then each page opened from the mailbox is a fragment.
I tried adding the following to each of the EditText areas in the fragments. However, this does not close anything.
InputMethodManager imm1 = (InputMethodManager)getActivity().getSystemService( Context.INPUT_METHOD_SERVICE); imm1.hideSoftInputFromWindow(input1.getWindowToken(), 0);
I also tried to put this code in the main action, but it also failed there. Any ideas on what I can do differently to get this to work?
source share