Usually, in an Activity or fragment with several widgets, including one or more EditTexts, the focus automatically shifts to the first EditText at the top when the Activity opens, causing the virtual keyboard to appear. This can be distracting, as the keyboard may cover other content being displayed. To disable the automatic focus on EditText, you just need to add two lines in the XML layout above the main layout.
Solution
Simply add the following two attributes to each EditText, and the issue will be resolved:
android:focusable="true"
android:focusableInTouchMode="true"
Requesting Focus for EditText
When you disable auto-focus, you may still want to focus on a specific EditText when needed. To set the focus manually, simply call requestFocus() on the desired EditText:
editText.requestFocus()