There is no easy way... using your own group-indicator drawable and
specifying the 'state_empty=true' doesn't seem to work too well, but I could
have made some mistakes...
This is what I did:
Add a onGroupItemClickListener to your expandable list-view and return true
in the onGroupClick metho
indicator is an imageview.Then , I tried to set the visibility of
this image depending on the number of children. But when I debug the
"if( getChildrenCount( groupPosition )==0) {
indicator.setVisibility( View.INVISIBLE );. " the app crashes. The
"0" is the problem, beacause when I turn it to
Streets Of Boston I understood completely that's you told, but my
problem is tha the "getChildrenCount( groupPosition )==0" brings me
force close.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android
What does logcat say about the crash? Is it a NullPointerException? What
does the "caused by" line say?
Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware
On Wed, Jun 29, 2011 at 10:17 AM, juliagrig wrote:
>
> Streets Of Boston I understood completely that'
06-29 19:45:34.471: ERROR/AndroidRuntime(435): FATAL EXCEPTION: main
06-29 19:45:34.471: ERROR/AndroidRuntime(435):
java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
06-29 19:45:34.471: ERROR/AndroidRuntime(435): at
java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.j
*> 06-29 19:45:34.471: ERROR/AndroidRuntime(435):
java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2*
According to that it looks like your "groupPosition" variable refers to an
invalid index...
Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware
2
The "groupPosition " is wrong? But I don't know why is this happen. Because
I have this code int the getGroupView() method in my adapter, so this is
being called for each group. But the app crashes only if I have a group
with no children. I can't understand. :p
--
You received this message beca
Now, since you can easily reproduce this crash, do just that, with
breakpoints in your adapter code. Then step through and check what goes
wrong, where it's different from how you think it's supposed to work.
-- Kostya
30.06.2011 0:53, ΙΟΥΛΙΑ ΓΡΗΓΟΡΙΑΔΟΥ пишет:
But the app crashes only if I ha
The 0 is not the problem.
You have a group with no children, and that's quite logical, because
that's exactly the case you are trying to customize (hide the group
indicator).
The problem is the code executed in that case, under the "if":
"indicator.setVisibility(View.INVISIBLE)".
I believe
View ind = v.findViewById( R.id.explist_indicator);
ImageView indicator = (ImageView)ind;
indicator is just a name of an image viewa and I change the visibility.
The code works perfectly when I change the value of the
getChilderCount(groupPosition) to something other than 0.
--
You receiv
Well, then probably something is different about the layout of "v", so
that findViewById returns null for the given "id".
Or maybe it always returns null, but your code only tries to access the
value when getChildrenCount is 0.
Either way, the view with id= explist_indicator is not there when
Ok, I 'll see this again and then I 'll tell you my news/ :-) Thanks you
very much!
--
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, se
12 matches
Mail list logo