I have a custom ListView within Activity A, each row comprising of some imageViews and textViews.
First I navigate from Activity A to Activity B by using startActivityForeResult() method. I have succeeded in tracking the return from Activity B to Activity A through onBackPressed() method.
Now, I want to trigger a image refresh (change of image based on some data values) for one of the imageViews within a particular listView row, when I return from another activity B, based on some data values set in that second activity.
Currently I figured out that I can pass the position value of the listview row through the transition from A to B and back to A, but I am stuck on the further implementation.
How should I go about this? Most of the posts I see here talk about triggering image change from within an OnClickListener for that listview row. However, I need to do this based on the event of returning from Activity B to Activity A.
Any suggestions would be greatly appreciated. TIA.
The short answer is that you should never access a single
ListView row and update it's
View (There are ways to do it by keeping a reference to the displayed views, but you shouldn't).
What you should do is:
notifyDataSetChanged()for that adapter.
There is no good reason not to follow this and update just one row (because if it takes too long to update the views, it means you are doing something wrong).