Question

I have a set of data which I want to display to the user in an AdapterView, which I will also want to change at runtime while the view is being displayed. How do I have the view for the object whose data has changed redisplay itself?

For example, I have a set of books, which the user can download, and I want to display books that are being downloaded in addition to books present. I want to update the download progress for the user to view in real time.

In this case, how should I notify my view that it needs to be updated? Should I have a callback on the view itself, or should I invalidate the AdapterView? If I have a callback on the view, I want to be careful not to cause any leaks.

Was it helpful?

Solution

You should be able to do notifyDataSetChanged to force the View to update (see http://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged%28%29) and that should be all you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top