On Tue, Aug 2, 2011 at 2:04 PM, julius <jul...@msa.co.nz> wrote: > It appears that loadInBackground returns a new Cursor and after this > deliverResult runs which closes the old Cursor and makes the swaps in the > new Cursor.
Right. That's exactly what CursorLoader.deliverResult() does. > It looks like in deliverResult we look to see if there is an old Cursor and > close it in AsyncTaskLoader's onReleaseResources and just set the member > object Cursor (mApps) to the new Cursor. > In the example code though I see the following and am confused: > > List<AppEntry> oldApps = apps; > mApps = apps; Looks like a typo to me. And because it's just a list, and onReleaseResources() does nothing it works fine. BTW, onReleaseResources() is just a convenience method, it's not in AsyncTaskLoader. > Anyhow, after deliverResult I'm guessing onLoadFinished runs. At this point, > now the Cursor is refreshed, do we just need to use notifyDatasetChanged on > our Adapter? If you have a CursorAdapter, you need to call swapCursor() first. (*not* changeCursor()). > A little diagram of the flow would be quite handy. If someone can confirm > this flow of events I'm happy to make a diagram. Be sure to tell us if you do make it :) Making it a bit clearer what methods are required to be implemented/overriden in the docs would be nice too. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en