Handling focus in ExpandableListView

by Brian » Sat, 26 Sep 2009 02:17:19 GMT

Sponsored Links
 Hi there,

I have been tinkering with the ExpandableListView and would like to
tweak its behaviour a little bit. Right now you can navigate through
the expandable list and when you select an entry (group) it will
expand and display its children.  However, I would like to expand the
group automatically as soon as the group receives the focus (almost
like a fisheye list).

I managed to overwrite  "onGroupExpand(int groupPosition)"  to close
all other entries before expanding the selected group. But I cannot
find any way to install any focus listeners which gets notified when a
group receives focus... Does anyone know how to do this?

Regards, Brian


Handling focus in ExpandableListView

by Justin Anderson » Sat, 26 Sep 2009 12:45:40 GMT

 Try implementing the AdapterView.OnItemSelectedListener interface...


There are only 10 types of people in the world...
Those who know binary and those who don't.


Sponsored Links

Handling focus in ExpandableListView

by Brian » Wed, 30 Sep 2009 03:26:51 GMT

 Yeah - works like a charm!
Thanks, Justin!

Here the code snippets for others to reuse:

public class ProjectList extends ExpandableListActivity
        implements AdapterView.OnItemSelectedListener


    public void onCreate(Bundle savedInstanceState) {

        ExpandableListView listView = getExpandableListView() ;
        listView.setOnItemSelectedListener(this) ;


    //-- Callback when an (group) item is selected in the list
    public void onItemSelected(AdapterView<?> arg0, View arg1, int
arg2, long arg3) {
        Log.d( Constants.LOG_TAG, "onItemSelected()" );

    //-- Callback when nothing is selected in the list
    public void onNothingSelected(AdapterView<?> arg0) {
        Log.d( Constants.LOG_TAG, "onNothingSelected()" );


Other Threads

1. view list of extra's for a intent

i'm trying to find out what extra's there are for a specific intent..

in the eclipse debug window i can see it has extra's , but i can''t
find a list of those extra's.
I also can't find a function to get all extra's into a human readable



2. Moto Milestone device drivers for XP/32?

I am trying to find Moto Milestone device drivers for XP/32 so I can
debug on the device.
There's some info and software available on Motorola's web site,
however it points to more generic drivers for iDEN and other types of
devices; this doesn't seem to provide what I'm looking for. I am sure
there's plenty of devs who are using a Milsteone/DROID as a dev
device... any pointers?


3. Contacts is missing a very important function

4. List of Android Apps by license

5. Running Flash 10 on Android 2.1

6. Unknown DNS queries

7. ContextMenuInfo null in ListView