Akarsh M
Akarsh M

Reputation: 1611

I have a Custom ListView with an ImageView and TextView?

I have custom ListView with an Image of Right Sign.

What I want is that whenever I click on any list row the sign of Right (Image) is occur on the clicked list row and remove that right sign (Image)from the previous row LIKE radio button?
What should I do ?

Upvotes: 1

Views: 106

Answers (2)

oks16
oks16

Reputation: 1294

  1. Create a custom Adapter
  2. Maintain the current selected position as a instance variable of the adapter
  3. In getView, toggle your image view accordingly based on the current selected position.
  4. And finally, in the OnItemClickListener of your listview, set the current selected position variable of the adapter with the current selected position.

Upvotes: 1

kaushal trivedi
kaushal trivedi

Reputation: 3443

You can do it manually by storing flag (boolean) variable for each of the item you set with listview.

Than change the flag to true of the item that is clicked . Use listview.notifyDatasetChange() in onItemClick() so that listview get effect.

Upvotes: 0

Related Questions