I’m implementing a home screen app widget. I was wondering which is better to store/read data: SharedPreferences or a SQLite database? The data is accessed from an AppWidgetProvider (similar to a BroadcastReceiver), and any given instance of the widget displays different data based on appWidgetId. Is one way or the other frowned upon?
It really depends on your use case. Preferences are meant to be a simple, lightweight mechanism to store key-value type of data while an SQLite database provides you with a whole framework for storing and retrieving relational data (queries, transactions, etc.).
This article gives an overview of both and also covers custom files and network as alternative ways to persist data.