开发者

How can I clear my Gallery view before leaving an activity?

开发者 https://www.devze.com 2023-04-10 13:01 出处:网络
I have two Activities i开发者_JS百科n my App, one is a ListView which displays a list of items.When a user clicks one of these items, it opens up a new Activity which then downloads a bunch of thumbna

I have two Activities i开发者_JS百科n my App, one is a ListView which displays a list of items. When a user clicks one of these items, it opens up a new Activity which then downloads a bunch of thumbnails from a website and displays them in a Gallery. Currently, when I click the back button from the 2nd view and then select a new item from the ListView, when the 2nd Activity is displayed again the gallery still shows the old images until the new images are downloaded. How can I clear out the gallery before it is displayed after the 2nd ListView item click?


Whatever list or array of items is backing your Gallery's adapter, just clear it and then call adapter.notifyDataSetChanged(). You can do this in the onPause() callback of your 2nd Activity.

0

精彩评论

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