Tuesday, September 20, 2011

[android-developers] using CursorLoader for high frequency "one-shot" queries

I'm just getting familiar with the Loader framework, but they seem
geared for queries where you keep the cursor around, so the Loader can
manage / requery when changes occur to the underlying Uri.

But what about those queries that are one-shot type things, where you
need the data in the cursor for some reason, and then just want to
close it right away?

I guess I could do something like this in
LoaderManager.LoaderCallbacks.onLoadFinished(Loader<D> loader, D data)

{
... get required data out of cursor
getLoaderManager().destroyLoader(loader.getId());
}

This seems kinda heavy though in situations where i expect to be doing
many of these kinds of queries. I would expect a bunch of bookkeeping
to get updated, as well as GC activity too.

Should I keep using AsyncQueryHandler for this scenario?

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate