Couldn't clear an ArrayAdapter
-
28-10-2019 - |
Question
I have a GridView
backed by an ArrayAdapter
. Everything works except for one thing: I couldn't clear that adapter (need this when refreshing the `GridView).
This is what I have:
adapter.clear();
adapter.notifyDataSetChanged();
Prior to this project I have never had any issue regarding adapter clearing. I can't find what I am doing wrong here.
Any idea? (don't hesitate to ask for specific details).
Thanks!
Solution
Problem solved.
I had to keep a reference on the collection that the adapter was taking its data from and then do:
myCollection.clean();
adapter.notifyDataSetChanged();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow