Possible Duplicate:
Stop EditText from gaining focus at Activity startup?
I have an activity has a EditText inside, and each time when the activity starts up, the EditText automatically get the focus.
I don't want the EditText gets the focus automatically, how can I do?
I had the similar issue and i am sure this is the problem, for that you just need to do a small trick.
Add this LinearLayout before the EditText which is getting focus at activity startup. You don't need to set any value inside the EditText.
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0dip"
android:layout_height="0dip"
android:id="@+id/dummyView"/>
Add this in <activity>
tag in your manifest for activity in which edittext is present.
android:windowSoftInputMode="stateHidden"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With