How to customize focus navigation in a ViewGroup

by n179911 » Wed, 29 Jul 2009 10:29:33 GMT

Sponsored Links

I have a View Group and it has 2 focusable Views as its children.
I would like know how I can customize how focus is being passed
between these 2 Views. In other words, when I press the Down Key or
the Up Key in the emulator, i want to control which of these children
has focus.

I read the JavaDoc of ViewGroup, I see these 2 methods.

public View focusSearch (View focused, int direction)
public boolean requestFocus (int direction, Rect previouslyFocusedRect)

But I am confused which of these method I should over-ride to achieve
what I want.

Thank you for any advice.



Other Threads

1. Building SQLite

I am trying to build SQLite on my windows machine.  I was able to
build the ndk samples previously.  I executed the command

make -f

from within the bourne shell of cygwin and get the following error

make: *** No targets.  Stop.

I picked up the source from;a=summary

There appears to be two files.  One in the Android
directory and the other in the dist directory.  I tried both with the
same result.

I could not find any instructions on how to build.  Hopefully I don't
have to download the entire platform to build this one piece.


2. Spinners identical in XML but look different when run

That has nothing to do with it.

That is determined by the adapters you put in the Spinners. The
adapters are responsible for the Views that go in the Spinners, both
for the selected item and for the available items in the dialog that
appears when the user presses the drop-arrow.

Use the same layouts in your adapters.

Mark Murphy (a Commons Guy) | |

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!


3. Detecting slow or unavailable network and black screen

4. android application error reports

5. OOT: Paging GilaOriginal

6. Detecting slow or unavailable network and black screen

7. Yahoo messenger update 1.0.2