Skip to content Skip to sidebar Skip to footer

Updating Gridview Child

I have a GridView loaded in an Activity with fragments present. The GridView itself is not located in a Fragment. I created a customer adapter by way of BaseAdapter and everything

Solution 1:

this doesn't seem right:

ImageViewimage= (ImageView)videoGallery.findViewById( position );

the reason : position is set to be 0<=position<=count-1 . the id is a totally different thing .

you need to update the raw data itself , and tell the adapter to update its views , for example using notifyDataSetChanged() .


EDIT:

that's not the only problem . the real problem is that you create a new ImageView for the getView() , always (this , btw, causes a memory leak since adapterView caches its created views ) , instead of recycling it . you should really watch the video "the world of listView" .

the reason that it doesn't work for you is that you access old views that aren't used anymore.

Post a Comment for "Updating Gridview Child"