Database and Web Services Models

I am watching a 2010 I / O 2010 video on this topic and I have a few questions to make sure that I understand correctly.

Google I / O 2010 - Android REST Client Applications

Please note that I also have a very limited understanding of CursorAdapters

Currently, my application has only a user interface layer. I created an object called DbAdapter using some Google tutorials to create a small database and a table in that database.

I created a class that I call DataBroker (extending ContentProvider) to control the retrieval of data from the database and the call of web services to update the data.

Scenarios:

1) Suppose I want to display a list of items in my ListActivity. Am I right in assuming that I write a function in my DataBroker that creates a cursor in a table in my database that contains these elements, starts a service that starts a thread that calls a web service to get additional elements, and then returns the cursor to my user interface theme? Doing this will most likely return the cursor to my UI thread before the end of the web service, but I guess after the CursorAdapter has a cursor, it will automatically show any changes made to this database table, right?

2) ListView. , . . DataBroker, , , STATE_DELETING ( ListView, , ), , , -, ?

, , . , Activity onCreate null, DataBroker?

+3
1

, , (, , )

, DataBroker. ContentProvider , , DataBroker.

1) . Activity, (DataBroker) - . , DataBroker , , Activity .

2) Intent , (DataBroker). STATE_DELETING, -, , , , , . , , STATE_DELETING, , , , . , Activity Cursor ( STATE_DELETING).

+1

Source: https://habr.com/ru/post/1760800/


All Articles