I suggest you use the Loader
framework in order to query things. If nothing else, refer to my answer to similar question, it provides some very relevant links, that could help you in your case study.
One more hint: if you just use straightforward approach, which is "query database through OpenSqliteDbHelper
instance from your Activity
", you have to be very careful and take care about your app lifecycle and Cursor's
lifecycle management. And of course, it is very hard to improve performance, if you use such approach. All these problems disappear like magic if you use the suggested Loader
approach, as it persist data on configuration change and you do not have to query your data again and again.
One more hint: if you choose to use the straightforward (that is, without Loader
) approach, make sure you query your data on a separate thread. That will keep your UI from being frozen.
Similar questions were already asked and answered here, use search, if nothing else