Sorted.
created a public explist variable and assigned it to the current list
every time a new adapter was called using the following call: list=
getExpandableListView();
then the "list.collapseGroup(i);" worked in my method below. before it
was causing the app to crash!
public void onGroupExpand(int groupPosition) {
System.out.println("GROUP LISTENER
WORKS?");
if(adptr=="expListAdapter"){
int len =
expListAdapter.getGroupCount();
//System.out.println(len);
for (int i = 0; i < len; i++) {
if (i != groupPosition)
{
list.collapseGroup(i);
}
}
}
else if(adptr=="expListAdapter2"){
int len =
expListAdapter2.getGroupCount();
for (int i = 0; i < len; i++) {
if (i != groupPosition)
{
list.collapseGroup(i);
}
}
//System.out.println(len);
}
else if(adptr=="expListAdapter3"){
int len =
expListAdapter3.getGroupCount();
for (int i = 0; i < len; i++) {
if (i != groupPosition)
{
list.collapseGroup(i);
}
}
}
}
I hope this benefits others, because for me, Despite posting on
numerous forums, nobody bothered to help. and in the end all I had
wrong was a minor error that took me days to figure out, whereas It
could have taken an android wizz maybe 10 minutes to work out.
so thanks for letting me post this up on this group. and thanks for
the lack of help or support.
Z.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en