jeudi 10 septembre 2015

Frequently updating SQLite DB and Listview (efficiency)

I'm developing an application which relies on database (local) - and this database updates frequently.

What I'm trying to achieve is: Suppose the data is shown in a listview. I want the listview to update the dataset as soon as any change in the database happens (or a specific table to be precise).

So far I've thought of these options:

  1. SQLiteOpenHelper class: whenever an update/insert is done it'll notify the activity to update listview via BroadcastReceiver.
  2. ContentProvider with CursorLoader (haven't used it before so a little skeptical)
  3. Something else? Please suggest.

Which is the best way to achieve consistent and immediate updates without blocking the UI (performance)?

Aucun commentaire:

Enregistrer un commentaire