It's not Godzilla vs. Mothra but I'm looking to contrast these two
components as part of a design question I have.

Reviewing some code recently I found that though the app was based on
lists and their individual elements, the code was built around cursors
as the main source of information shared across activities. As SQLlite
does not offer storage for anything other than simple types, a
CursorAdapter and its resulting cursor is then passed around to each
activity to maintain state.

Not many updates to the DB are needed so issues of committing the
changes are not a big problem. Of course as activities recede into the
background, staleness of the Cursor does crop up and reactivate calls
are needed periodically, though sometimes the cursor is passed on to
an activity simply to keep it alive.

Contrasting this datacentric approach an initial call to the DB could
be followed by the marshalling of the pieces into objects in the List.
Then using an application object current state could be preserved and
any activity that needed it could simply get one or more of the base
objects that encapsulate the business logic.

Could someone weigh in on the pros and cons of either approach ? Would
more resources be used to maintain a list of objects vs a cursor of
the constituent elements ? Does synchronization make it safer to use a
List of objects rather than the fragments of data held in a cursor
shared among activities ?

thanks for your input.

R

-- 
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

Reply via email to