I'm watching the 2010 Google I/O video on this topic and I have a few questions to make sure I understand properly.
Google I/O 2010 - Android REST client applications
Please note I also have a very limited understanding of CursorAdapters
Right now my application just has a UI layer. I've created an object called DbAdapter using some Google tutorials to create a small database and a table in that database.
I've created a class I'm calling DataBroker (extending ContentProvider) to manage retrieving data from the database and calling web services to update data.
Scenarios:
1) Suppose I want to display a list of items in my ListActivity. Am I correct in assuming I will write a function in my DataBroker that creates a Cursor to the table in my database that holds those items, fire up a service which launches a thread which calls a web service to get additional items, then return the Cursor to my UI thread? Doing this would likely return the Cursor to my UI thread before the web service finished, but, I'm assuming, once the CursorAdapter has a Cursor, it will automatically show any changes made to that database table, yes?
2) Now I have a list of items in my ListView. Suppose I give the user some functionality to delete an item. The user executes this functionality. It should call a function in my DataBroker which updates the row in my database corresponding to that item, setting the status column to STATE_DELETING (which will remove the row from the ListView because the Cursor has a clause excluding this state), then fire off a service that fires a thread that hits my web service, then deletes the row in the database when finished?
Also, suppose I have multiple Activities, am I looking at having a static Cursor for each Activity with a list, grabbing that Cursor in the Activity's onCreate, and if that Cursor is null, hitting my DataBroker?