I’m searching a method to navigate in a app throw all elements with a virtual dpad. But how do I find the nearest neighbor in the directions up, down, left and right?
e.g I have an event received to go down, now I want to set the focus on the button below.
I don’t want to use the definition in the xml files like this:
<LinearLayout android:orientation="vertical" ... >
<Button android:id="@+id/top" android:nextFocusUp="@+id/bottom" ... />
<Button android:id="@+id/bottom" android:nextFocusDown="@+id/top" ... />
</LinearLayout>
How can I do that?
Thx.
I found the smart solution (e.g for go down):
Thats all, an internal algortihm find the next element in your selected direction