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. Is ViewFlipper startFlipping() random?

Dear all,
               I'm developing an application that can take an
arraylist of images of varying length and display them in the order in
which they are added to the arraylist. I use viewFlipper.addView() to
add each image. When I call startFlipping() the images are displayed,
but not in any particular sequence, and they are then repeatedly
displayed in a random sequence and not in the original sequence. Has
anyone else found this? If so, what's the work around?



2. Clear Screen Guard dan Pull Leather case For Spic

RR & Om Mod

Numpang nawarin di jalum as subject Khusus untuk Samsung Spica.

1. Screen Guard Rp. 40.000
2. Pull Leather Case Rp. 75.000

Yang minat bs email atau sms ke 0816940715. Pic ada nanti di emailin.
Reply aja di thread ini alamat emailnya. Berhubung post nya via amplop
merah gak bs attach ment.

Banyak thx..

Sent from my mobile device

"Indonesian Android Community [id-android]" 


4. Web Apps for Dummies?

5. PowerManager userActivity() ... how does this work?

6. Out of Memory for Large Images

7. 铮? IPhone dan Android (N1