How to force my GridView adapter to reload?

adapter, android, fragment, gridview, handler

Solution

Make an Adapter for the gridview that extends from BaseAdapter, or use an Adapter that extends from BaseAdapter.

then call notifyDataSetChanged on that adapter when the contents of your collection has changed.

Small example of adapter and grid

Problem

I'm an Android beginner starting with fragments. My problem is the following. I has a fragment that used to show a custom listview (it extended SherlockListFragment). I populated the listview with some data server. The action of retrieveing data of the server was executed in another thread and I had a handler to manage responses. In this handler (inside my fragment) I recovered data for my adapter and the I reloaded my adapter like this `((myAdapter) fragment.getListAdapter()).dataChange();` . Well, now I wanted to convert the list in a custom grid cause I think it's much better for my app. So, the fragment doesn't extends SherlockListFragment, but BaseFragment. As I don't have a ListView anymore, I can't not use "getListAdapter.datachange()". Does anybody know the correct way to do this? Thanks in advance.

Original source