Thanks for the replies.  If I have a Cursor, where and how would I go about 
swapping the old Cursor for the new one?

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.

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;

I'm guessing that apps is the new result, in this case a List<AppEntry>. 
 Above it looks like a new object called oldApps is being populated with the 
new result *as well as* the member object mApps.

I would have expected it would be something like this (note the difference 
in the first line):

 List<AppEntry> oldApps = mApps;
            mApps = apps;

so when running:

    if (oldApps != null) {
                onReleaseResources(oldApps);
            }

the oldApps Cursor (if this were a Cursor) could be closed. Can someone who 
wrote the example confirm my expectation or explain it?

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?

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.

Thanks for all the replies and help; I feel like I'm making progress! 
 Thanks for the tip on onStartLoading() I think I read that in another 
thread, but it's great to have it confirmed again.

Cheers,
Julius.

-- 
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

Reply via email to