Pergunta

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!

Foi útil?

Solução

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();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top