Saturday, December 31, 2011

Re: [android-developers] Re: Expandedlistview

On Sat, Dec 31, 2011 at 6:21 AM, Sean751 <sean751@gmail.com> wrote:
There is an example for using the onChildClick and in onCreate the line getExpandableListView().setOnChildClickListener(this); is included

That implies that in this example the class referred to by "this" implements the OnGroupClickListener interface. Does it?
 
so if I want to also have onGroup click I assumed that I need getExpandableListView().setOnGroupClickListener(this);

You need an OnGroupClickListener, where you get it from, whether it is "this" or another instance, is fairly irrelevant. 
 
but that causes an error the suggestion in Eclipse is to change it to getExpandableListView().setOnGroupClickListener((OnGroupClickListener) this);

Eclipse doesn't know any better. You should. This will get it to compile but will crash as you saw.
 
I am after any item click if there is another way, the code that I want to run onClick is the same for Group or Child. I can see in the parent class there is an event but I don't know how to use it, I am new to this.

You may need to take a step back and learn some Java first, as it appears you're getting hung up on some basic semantics of the language.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate