Reputation: 1945
I have an activity with a listView, which uses a custom row layout defined in an XML layout file. The row layout consits of several string along with an ImageView holding an icon to reflect a user decision on that respective list element.
For each element of the list view, using the contect menu, the user can choose an action e.g. to keep the clicked element, dispose it, or do something else. Initially the rows of the listView are rendered with a question mark icon to show that no action has been chosen for that entry. If the user choses one action, I want to change the icon according to that action, to show the user later on which action he has decided for that element.
From within onContextItemSelected, how can I get access to the row layout and dynamically change the icon within the ImageView?
Thanks for your help!
Upvotes: 0
Views: 719
Reputation: 3127
You need redraw list. I think it's in adapter getItem where you set content to your labels and image.
So from your onContextItemSelected edit item in list adapter and then call yourAdapter.notifyDataSetChanged();
Upvotes: 1