Reputation: 6134
Can somebody explain me the flow of control in this tutorial : http://www.vogella.de/articles/AndroidSQLite/article.html#tutorialusecp
I am not able to get the right flow. I am completely a novice to this content provider etc.
I wanted to know when does actually the DB gets created, what are the lifecycle methods and what is the sequence of method execution in this project ?
Upvotes: 3
Views: 3639
Reputation: 6134
Finally found the Flow!! :
First of all, the onCreate
of Content Provider is called just when the application launches as we have registered this in Manifest.
Then, onCreate
of our first Activity, i.e. onCreate
of ToDodOverviewActivity.
the call to fillData()
has the initLoader()
call which in turn calls the onCreateLoader
of the Loader.
Then, here at
CursorLoader cursorLoader = new CursorLoader(this,
MyTodoContentProvider.CONTENT_URI, projection, null, null, null);
creation of Loader takes place. a loader that queries the ContentResolver and returns a Cursor. This class implements the Loader protocol in a standard way for querying cursors, building on AsyncTaskLoader to perform the cursor query on a background thread so that it does not block the application's UI.
This in turn leads a call to onCreate()
of DataHelper and ToDoTable etc and here everyone know the flow about SQLiteOpenHelper.
Finally, onLoadFinished()
gets called which in turn swaps the cursor and updates the adapter.
Upvotes: 3