views:

66

answers:

2

I have a ListView displays information about an object. When I click a ListView Item, I open an Activity that let's me manipulate parameters of the object held in the adapter. These parameters are updated and stored remotely.

When I return to the ListView (via the back button), I want to update the ListView Item that I clicked originally by requesting the parameter values from the remote server.

I am currently doing this up updating the entire ListView by clearing it and rebuilding it.

How do I reference the ListView Item so that I can update the data for that item only?

Thanks, Jason

+1  A: 

Just set the data for your adapter and call notifyDatasetChanged. Android only draws the rows that are visible anyway, so it's pretty efficient.

synic
I need access to the Views within the ListView item prior to setting the data. Obtaining the data is a time consuming process and I want to replace an icon in the ListView item with an indeterminate progress bar.I can update the entire ListView, and visually it does OK. The new data just appears. However, there is no indication to the User which ListView item is being updated.Again, this is upon returning to the Activity. I am able to visually indicate using a progress bar within the ListView activity by using onClick event handlers.
tunneling
I guess it really depends on how you're creating your ListAdapter. With ArrayAdapter you can just use getItem(index)
synic
See my answer, sorry if I was unclear in my question. If I can hi-jack my own thread... how do I keep the correct value in the variable "position" when I leave and return to the activity? I was hoping to use a static field, but it get's set to zero when I return to the activity.
tunneling
figured this out too.. upon returing.. my global variable "position" was getting reset by getView()
tunneling
A: 
tunneling