IOW, the OP most likely should not be using ArrayAdapter at all, but relying on CursorAdapter talking directly to the ListView; it really is tailor-made for this situation. ArrayAdapter is really meant for a different situation: when you have a (static) array containing the data to be displayed.
Cursors, ContentResolvers and ContentProviders are discussed together so often, it is easy to forget that -- just as Dianne said -- CursorAdapter does not actually depend on a ContentProvider. Nor does Cursor itself. On Sep 21, 9:37 am, Dianne Hackborn <[email protected]> wrote: > What you are doing is potentially really inefficient. Improving it is not > really a matter of using a content provider, but using an adapter that > doesn't require you load all of the data up-front. Adapters are designed to > be able to load data on demand as needed, which CursorAdapter does. > > Also not that as far as I know CursorAdapter doesn't have a dependency on > there being a content provider. It just wants a Cursor, which you can get > from any SQLite database. > > > > On Tue, Sep 14, 2010 at 2:21 AM, Samuh <[email protected]> wrote: > > We are connecting to a number of WebServices and fetching a lot of > > structured data(XML). We are parsing this data and storing them into > > SQLite tables. This part of the application runs periodically in the > > back ground. > > > On the foreground, the data fetched is displayed in ListViews. We have > > used ArrayAdapter to back these lists up. The thing is, every time the > > Actvity starts or data set is refreshed, we have to load the > > ArrayLists by querying the database and call notifyDataSetChanged() on > > the Adapter. > > This slows down the application and affects the User experience. > > > Question: > > 1. I'd imagine using a CursorAdapter might result in performance gain, > > since the framework will take care of managing the cursor. Is this > > assumption valid? > > 2. Will the CursorAdapter take care of reflecting updates to the > > database on the screen automatically? > > 3. Will I have to write a ContentProvider if I choose to use > > CursorAdapters? > > 4. Are there any other considerations that we need to make? > > > Please help. > > > Thanks. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] 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

