开发者

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.

  1. I want to clear the gridview before the other data is loaded. I can't figure this out.
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜