<LinearLayout
android:id="@+id/loginInputs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/txtUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="User Name"
android:imeOptions="actionNext"
android:text="" />
<EditText
android:id="@+id/txtPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:inputType="textPassword"
android:text="" />
</LinearLayout>
I want to get the next focus of txtUsername in code. If I set the android:nextFocusDown
attribute, I can get it by using txtUsername.getNextFocusDownId();
. ( When softkey enter pressed focus moved to nextFocusDown) I want to know that is there any method to get the default next focus by code without setting focus attributes.
I can get the same functionality by setting focus attributes to all the EditTexts. But I feel there should be a better way of doing it.
P.W. I want to do some logic according to the next focus. I don't want to change the focus.