I don't know why but Keyboard automatically opens when I open BottomSheetDialogFragment from another fragment. I tried with both navigation component and old method. I tried on API 24, 27, 30. On API 30 its working fine but in 24 and 27 facing this issue. Anyone here who is facing this issue? And Anyone who have solution for this problem please post answer.
Asked
Active
Viewed 167 times
2
-
You can add this code in AndroidManifest.xml file `android:windowSoftInputMode="stateAlwaysHidden|stateHidden"` in your activity, It will helps to prevent keyboard open. – Android Geek Jan 21 '22 at 04:55
1 Answers
0
this is not the best way to do that but you can use this code to disable the keyboard in your onActivityCreated function in a fragment:
InputMethodManager i = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
i.hideSoftInputFromWindow(getView().getWindowToken(), 0);
it is better to find the cause of why the keyboard comes up automatically but you can use this solution if you want.

special N9NE
- 21
- 6
-
Thanks for answering! I already did that but this approach is also not working. – AndroidD Nov 24 '21 at 14:34
-
@AndroidD OK, try this code again but this time put it on the onResume method. – special N9NE Nov 25 '21 at 13:12
-