Keep d-pad focus changes within current fragment

567 views Asked by At

I have an android app that primary receives input using a d-pad (up, down, left, right, OK, back)

The app runs on a TV so uses fragments to separate sections.

I would like to keep directional buttons from focusing views in other fragments. And handle directional buttons differently depending on what fragment is set as the "current"

What would be the most elegant solution to this?

also, Fragments are dynamically changed at runtime.

1

There are 1 answers

0
pjv On

When the d-pad is the only means of navigation for a user, such as on some Google TV's, then it's not a good idea to stop the navigation at the edge of a fragment. How I solved this, is by allowing cross-border navigation and laying out elements so that the navigation is not awkward and works by finding the path automatically (after all, there does not seem to be a way to statically provide the next element to focus on in each direction, when in another fragment).

Like you I'm looking for reference advice on how to deal with fragments and navigation on Google TV.