Pankaj Khurana
Pankaj Khurana

Reputation: 3271

How do i replace a particular image if i have position information of that image in gridview?

I am using gridview with image adapter to render images.

I want to know whether it is possible to replace a particular image if i have position information of that image?

For. e.g. i have a variable previous location in which i store the previous selected image position lets say its 1 (rectangle image). Now i want to replace the image at location 1 with some other image (square image). How can i do this?

Upvotes: 0

Views: 531

Answers (1)

sat
sat

Reputation: 41076

check , getChildAt(position) API http://developer.android.com/reference/android/view/ViewGroup.html#getChildAt(int)

once you get the reference to the particular childView , you can change the image.

Upvotes: 1

Related Questions