You could either cache the results locally and return them when asked, 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. Also, note that CursorAdapter has the changeCursor() method, which helps with doing async things. In onCreate() you can create your CursorAdapter and pass null for the cursor and then call changeCursor(newCursor) when the async query completes. changeCursor() takes care of closing the old cursor for you, which can make managed cursor unhappy, so you'll either have to manage the cursor yourself or call stopManagingCursor(adapter.getCursor()) before calling changeCursor().
-Jeff On Wed, Sep 17, 2008 at 2:12 PM, Kavi <[EMAIL PROTECTED]> wrote: > > Hello, > As per the subject, i am making an app that is dependent on data that > comes from a network request. > I was using the UserTask class (Made by Mr. Romain Guy) to make the > network calls and get my data and everything worked. > > But now, i want the data from this app to be available to other apps > as well and thus, the only way that data could be shared between > applications is by using a content provider (thats what i have read so > far). > > My question was: Is it possible to use a thread or the UserTask class > inside a Content Provider and if yes, then since the request to the > server can take a long time, how do we change the query method of the > content provider to handle such a delay as it is suppose to return a > Cursor object. > > In my initial approach, i was using a listener that took care of > updating the Application when the data was available but i am not > aware of a way to use a listener with a Content Provider. > > Any help or ideas would be helpful. > > Thanks > > - 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 -~----------~----~----~----~------~----~------~--~---