Lifecycle / flow management in content provider?

Can someone explain me control flow in this tutorial:

I cannot get the correct stream. I am completely new to this content provider etc.

I wanted to know when the DB is actually created, what are the lifecycle methods and what is the sequence of execution of the method in this project?


source to share

1 answer

Finally found a thread!

First of all, the onCreate

Content Provider is only called when the application starts up, when we have registered this in the manifest.

Then onCreate

our first action, i.e. onCreate

ToDodOverviewActivity. a call fillData()

has a call initLoader()

, which in turn calls the onCreateLoader


Then, for

CursorLoader cursorLoader = new CursorLoader(this,
            MyTodoContentProvider.CONTENT_URI, projection, null, null, null);


Loader is being created. a loader that asks for a ContentResolver and returns a cursor. This class implements the Loader protocol in a standard way for requesting cursors, relying on the AsyncTaskLoader to execute the request for the cursor on a background thread so that it does not block the application's user interface.

This in turn calls the onCreate()

DataHelper and ToDoTable, etc., and everyone here knows the SQLiteOpenHelper thread.

Finally, it is called onLoadFinished()

, which in turn changes the cursor and updates the adapter.



All Articles