Sync database with UI
When we use CursorLoader
with a content provider, the data returned in the cursor is directly connected with the data in the database in such a way that one change in the database is reflected instantly in the UI. When we have this system working, all we need to worry about is storing the data in the database and updating the data. When we have this system ready, we will discuss how to implement the popular pull to refresh system to update the job offers at the time the user wants. The goal is to add a new job offer in Parse, pull the list to refresh, and see the new element come instantly, all handled in the background through the content provider.
Implementing CursorLoader
To complete this goal, the next step is to create CursorLoader
. We talked about loaders previously in the book; as we mentioned, they are a mechanism to load data in the background. This one specifically will return the data in a cursor and load it from a content provider. It will also refresh the...