In my class I create two EditTexts.
editText1 = (EditText)findViewById(R.id.EditText1);
editText2 = (EditText)findViewById(R.id.EditText2);
When I start the app, the cursor is automatically put in the second EditText. How can I change to be set in the first EditText? Should I change something programmatically or in the XML?
you can try:
editText1.requestFocus();
there is two way of doing this one in your class like
editText1.requestFocus();
and another in xml like
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<requestFocus />
</EditText>
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