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...

Thanks,
Justin

----------------------------------------------------------------------
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

...

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(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. [GingerBread] Accelerometer sensor keep on generating events

Hi All,

In my device, accelerometer sensor is keep on generating events, even
in phone is in stationary.

Due to this non-stop event generation my phone conserve more power in
idle.
[it operates at high frequency state (p-state)]

With out accelerometer  power consumption is quite well.

Here is the getevent o/p for non-stop  events:

/dev/input/event1: 0003 0000 00000010
/dev/input/event1: 0003 0002 fffffeea
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000f
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 00000010
/dev/input/event1: 0003 0002 fffffee8
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000f
/dev/input/event1: 0003 0002 fffffee9
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000e
/dev/input/event1: 0003 0002 fffffeea
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000f
/dev/input/event1: 0003 0002 fffffee9
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0001 ffffffb1
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0001 ffffffb2
/dev/input/event1: 0003 0002 fffffeea
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 00000010
/dev/input/event1: 0003 0002 fffffee9
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000e
/dev/input/event1: 0003 0002 fffffeea
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000f
/dev/input/event1: 0003 0002 fffffee9
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000e
/dev/input/event1: 0003 0002 fffffeea
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0002 fffffee9
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 0000 0000000f
/dev/input/event1: 0000 0000 00000000

Please let me know if you have any inputs on this issue.

Regards,
Jagan

-- 

2. Unable to toggle breakpoint in eclipse

I am unable to toggle a breakpoint in eclipse.  When I try, it says
"The chosen operation is not enabled" and then greys out the "Toggle
breakpoint" option.

Any ideas?

-- 

3. New Tab Control In New Music App

4. Ask : root archos firmware 2.3.26

5. Change color of listview in custom dialog

6. How to autorun a script on startup(exec command not implemented in init.rc?)

7. froyo build error