dimanche 19 juillet 2015

Intent Service, Content Provider and Loader

When developing android applications I use Loaders to asynchronously retrieve data from a local SQLite DB through a content provider and update the Views.

When I have to retrieve data from the Internet (i.e. JSON) I use intent services. As the download finishes a broadcast receiver is triggered and the collected data stored through a Content Provider in a local SQLite Db.

Is there any way to trigger loaders execution after the DB is updated? The first time data are downloaded from the Internet I update the UI in the broadcast receiver after having updated the DB but it would be more coherent to do that through the loader as well.

Aucun commentaire:

Enregistrer un commentaire