[android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-04-02 Thread Paul Turchenko
Thanks, Mark. On Mar 31, 2:53 am, Mark Murphy wrote: > Paul Turchenko wrote: > > Well, how about filling list view with items dynamically? > > You still have to do the slow database query, which still has to be done > off the main application thread (e.g., in an AsyncTask). > > And you still have

Re: [android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-30 Thread Mark Murphy
Paul Turchenko wrote: > Well, how about filling list view with items dynamically? You still have to do the slow database query, which still has to be done off the main application thread (e.g., in an AsyncTask). And you still have to populate any Adapter attached to a ListView on the UI thread (e

[android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-30 Thread Paul Turchenko
Well, how about filling list view with items dynamically? On Mar 29, 11:05 pm, Mark Murphy wrote: > Paul Turchenko wrote: > > What is the most correct way to populate your list items from database/ > > contentprovider records when querying then takes too long? > > Run your query in an AsyncTask a

[android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-30 Thread jsdf
Neat. I'll give it a go. Thanks for the advice! -- 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+unsu

Re: [android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-30 Thread Mark Murphy
jsdf wrote: > > On Mar 29, 11:52 am, Mark Murphy wrote: >> jsdf wrote: >>> I then thought of trying to load the cursor in abackgroundthread, >>> but realize that this might be problematic, as theCursorAdapter >>> should be instantiated in onCreate() and should take a cursor as a >>> parameter. >>

[android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-30 Thread jsdf
On Mar 29, 11:52 am, Mark Murphy wrote: > jsdf wrote: > > I then thought of trying to load the cursor in abackgroundthread, > > but realize that this might be problematic, as theCursorAdapter > > should be instantiated in onCreate() and should take a cursor as a > > parameter. > > Why? Run your

Re: [android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-29 Thread Mark Murphy
Paul Turchenko wrote: > What is the most correct way to populate your list items from database/ > contentprovider records when querying then takes too long? Run your query in an AsyncTask and call setListAdapter() in onPostExecute() of the task. What, precisely, is not "desirable" about that solu

[android-developers] Re: Moving CursorAdapter cursor creation to background thread

2010-03-29 Thread Paul Turchenko
Hi Mark. I don't think that's a most desirable solution. For most cases, we'd like to have the CursorAdapter (which is attached to Cursor) populated in runtime with new entries from ContentProvider/ Database. I generally agree with jsfd that since activity offers managedQuery method, it would be re