Reputation: 505
I have four edittexts the problem is when i start activity the focus will be on the last edittext , how can i make the focus on the first edittext using xml ? Thanks
Upvotes: 6
Views: 8313
Reputation: 11
In Android Studio 2.3.3, you can click on the focusedByDefault attribute in the Properties panel on the EditText you want the focus on first.
Upvotes: 1
Reputation: 42016
onCreate(); of Activity
EditText firsteditText=(EditText)findViewById(R.id.first);
EditText secondeditText=(EditText)findViewById(R.id.second);
EditText thirdeditText=(EditText)findViewById(R.id.third);
EditText fourtheditText=(EditText)findViewById(R.id.fourth);
firsteditText.requestFocus();
Upvotes: 8