android - ExpandablieListView Flat list position function gives wrong position when previous group collapsed -


i want flat list position child, flat list position code:

int index = expandablelistview.getflatlistposition(expandablelistview.getpackedpositionforchild(groupposition, childposition)) 

its works fine, if , if groups expanded. problems ahead when 1 or 2 groups collapsed. position of same child of same group changed when 1 or 2 previous groups collapsed.

for example if position of second group child 3 when first 1 group collapsed. after expanding first group, position of second group child(same child previous selected) gets changed.

for practically can see code , please run code proper understanding.

@override     public boolean onchildclick(expandablelistview expandablelistview, view view, int i, int i1, long l) {          int index = expandablelistview.getflatlistposition(expandablelistview.getpackedpositionforchild(i, i1));         toast.maketext(getapplicationcontext(), string.valueof(index), toast.length_short).show();          expandablelistview.setitemchecked(index, true);   return true;     } 


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -