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.
精彩评论