I have a Expandable List View with a Custom Adapter. With a Spinner, a User can select if he only wants to see specific entries. If he selects something, I want to make every other row that doesnt match his request invisible/gone.
I tried this inside my ListViewAdapters getChildView()
if (special == 0 || special == Integer.parseInt(home) || special == Integer.parseInt(next)) {
return convertView;
} else {
convertView.setVisibility(View.GONE);
return convertView;
}
Unfortunately, it doesnt seem to work. The integer special indicates the selected Item in the Spinner, but I only get an "empty" ListView with all rows in it being empty. So they obviously arent GONE. The problem is that even those rows who fulfill the if-statement arent visible.... anyone knows a better approach?
Thanks in advance
You're trying to fix it in the wrong place. You don't want to alter the child view being returned (since this should be consistent for the display of data), you need to have your Adapter filter out data you don't want to show.
See this answer: https://stackoverflow.com/a/24771174/1544046