views:

11

answers:

1

I have subclassed ExpandableListActivity to create an activity that presents a simple tree view of the 'world at large' and allows the user to select one for further use by the app. I am having trouble setting focus programatically. One thing that baffles me is that I can use the D-pad to set focus on any of the child or group items in my ExpandableListView, but inside my onChildClick() callback, isFocusable() returns false. If I can set focus with the D-pad, how can isFocusable() return false?

My goal is to avoid having the user have to touch individual ExpandableListView entries to select them and to provide a couple of buttons to move the focus up and down inside the list. I want selection to be easy for folks with no D-pad or with a phone that only presents the D-pad when in landscape mode (e.g. Droid) .

Is there some way I can programatically inject D-pad key clicks into my app input event stream?

A: 

I don't think that's good idea to simulate D-Pad keystrokes in regular app, but if you really need that, see http://stackoverflow.com/questions/3526339/android-help-creating-a-button-that-produces-the-same-result-as-hitting-the-down/3526390#3526390

Konstantin Burov
Konstantin - I wondering what you think about the default Android listview focus and selection behavior. If you don't have a d-pad, I don't know of any way to navigate the list without using the other hand to touch the screen. I want this Activity to be easy to operate with only one hand in portrait orientation (i.e. Droid d-pad would be unavailable).The Contacts application has this same issue IMHO, you have to use the other hand to scroll and select unless you've got a d-pad available to you. Seems far from ideal ...
Mark