The goal is to sum up the amount columns in my SQLite database. Since I am using a ContentProvider to be able to export and share that data in the future, I understand that I am not supposed to directly access the database.
I am unsure which of the four following possibilities is the cleanest and if there are better ways to achieve the above goal.
- Using the standard
queryto return all entries and sum them up "manually". - Implementing a custom
Uriinquerythat returns aCursorcontaining the sum. - Implement a custom method in the
ContentProdviderthat returns the sum as a number. - Access the internal database of the
ContentProdiverand execute the command "manually".
If you would like to take a look at my code, check out my ContentProvider or the whole code on GitHub.
Aucun commentaire:
Enregistrer un commentaire