Nicolas Schubhan
Nicolas Schubhan

Reputation: 1756

Android : How change focus on form with out user action?

I've a form with 2 fields, after First login, i store the Mail in SharedPreferences and i restore when user start app again, But how to set focus on Pass Field ? it's not very nice to see that mail is fill but focus is still on mail field.

Thanks

<EditText 
android:id="@+id/Email" 
android:text="" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
android:layout_below="@+id/labelEmail" 
android:inputType="textEmailAddress"
android:padding="10px">
</EditText>

<EditText 
android:id="@+id/Pass"  
android:text=""
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
android:layout_below="@+id/labelPass" 
android:padding="10px"
android:inputType="textPassword"
android:password="true">
</EditText>

Upvotes: 5

Views: 15483

Answers (1)

Mark B
Mark B

Reputation: 200850

Call requestFocus() on the password field.

http://developer.android.com/reference/android/view/View.html#requestFocus()

Upvotes: 14

Related Questions