[android-beginners] Re: Handling focus in ExpandableListView

2009-09-25 Thread Justin Anderson
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.
--


On Fri, Sep 25, 2009 at 3:57 AM, Brian  wrote:

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Handling focus in ExpandableListView

2009-09-29 Thread Brian

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()" );
}



On Sep 26, 6:44 am, Justin Anderson  wrote:
> 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.
> --
>
> On Fri, Sep 25, 2009 at 3:57 AM, Brian  wrote:
>
> >  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
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---