I have an issue when the activity starts, android automatically places focus on the first edittext. How do I prevent android from doing that?
Have a look here
Or you could just hide the keyboard, focus remains on the EditText upon starting the activity:
android:windowSoftInputMode="stateHidden"
use setFocusable (boolean focusable) to prevent. http://developer.android.com/reference/android/view/View.html#setFocusable(boolean)
Three ways to solve this..
Set these attributes to the parent..
And now, when activity starts this layout getting default focus.
Also we can remove focus from children views in runtime (e.g. after finishing child editing):
findViewById(R.id.mainLayout).requestFocus(); or
Look in the AndroidManifest.xml element.
android:windowSoftInputMode="stateHidden"
It always hide key board when entering the activity.