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
Post a Comment