gridview of images is not getting refreshed
-
10-10-2019 - |
سؤال
i have a grid view with images populated from a list. when i remove an image from the list,i want the grid view to get refreshed.can someone tell me how to do this.
i have tried to invalidate() the gridview, notify the image adapter that the data set has changed(adapter.notifyDataSetChanged();). but this is not giving the desired results.
after doing this i am getting a blank in the place where the image that is removed used to be before.
المحلول
Do you use a ListAdapter to populate your view ? Maybe you should recreate a new adapter when your list changes.
نصائح أخرى
Try to use gridView.invalidateViews() instead of just .invalidate(). It redraws all views (ImageViews in your case) inside gridView.
لا تنتمي إلى StackOverflow