Question

I have a ListView with a custom CursorAdapter feed from a MatrixCursor. Each row in the ListView has an image that is loaded asynchronously, and when the image loading completes, I would like to signal the adapter to redraw the row in question. I do something similar already with data from a ContentProvider where I call getContentResolver().notifyChange to redraw a specific row. For a MatrixCursor, I can call notifyDataSetChanged, but that's not optimal, as it refreshes every row.

So my question is, what's the best way to go about redrawing specific rows in a ListView from a temporary source? Is there a way to set up "temporary" ContentUris, or some way to request that the adapter only invalidate specific rows?

Was it helpful?

Solution

I was able to achieve the same effect using setNotificationUri on MatrixCursor with an arbitrary URI, then using getContentResolver.notifyChange() to signal a redraw. While this works for me, I'd be curious to know whether this is an advised way of requesting redraw of specific items.

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