> You could either cache the results locally and return them when asked,

I was doing that earlier but since i switched to a content provider, i
decided to store data in
a SQlite database rather than a file. I also have to check for the
validity of the data on the device as it needs to be replaced
after a certain time interval.

> or better you could document that using your provider takes
> significant time and that users should do the calls asynchronously. In
> general it's good for applications to do content provider call
> asynchronously, since even local database operations could become
> pretty expensive. See the AsyncQueryHandler class, which handles much
> of the thread for you when trying to do async queries, or you could
> also use the wonderful UserTask class in the calling app to do the
> query asynchronously.

I had a look at the AsyncQueryHandler class. Since it's an abstract
class,
would i have to extend it to make it work? I tried looking for
examples on
Google on how to use this class but couldn't find anything. I found
what it does but didn't find anything on How to use it.

Also, i still have a doubt after your response.
In my initial approach, when i was not using a Content Provider, i was
using the UserTask class to make my network requests (So that my UI
didn't make a blocking call and the data was received in a separate
thread).

In my new approach with a Content Provider, if the caller app is using
the AsyncQueryHandler or the UserTask class, (which i think starts
another thread) , does that mean the Content Provider doesn't need to
use the UserTask class to make a network request or does it still need
to make the request in a separate thread.?

A clarification would be greatly appreciated.

> Also, note that CursorAdapter has the
> changeCursor() method, which helps with doing async things.

I am not currently using a Adapter. It wasn't as simple as connecting
a ListView with a Adapter
and that's why, i decided to update the Views myself by extracting the
info from the cursor.

- Kavik
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to