Android gridview clear/refresh contents
I have a gridview that loads when the app loads. The user can click on a button which gets other data to load into the gridview.
- I want to clear the gridview before the other data is loaded. I can't figure this out.
- I guess fixing #1 will take care of this, but when i DO click on the button to reload the grid, it doesnt refresh the grid. I know it's loading the data into the grid though, and this is the weird part, there just happens to be a search textview on the screen and when i click on that and the keyboard comes up, the new rows are appended to the existing rows in the grid. It's the only tim开发者_C百科e the grid is updated.
For clear:
just call clear()
on your adapter, that's how you clear the gridview.
I tried 1. clear(), try 2. notifychange but none of these work for me.
At last, i do a gridView.clear() before setAdapter then got it right,
cheers.
精彩评论