In my app, I want to add history and add to favorites features. It's an offline app of book details, hence I need to see which book detail was recently viewed a开发者_开发技巧nd save it to database. How to do that?
First of all have a rough estimate of the number of records you want ( history depth, favorites depth ).
How do you plan to reference a detail. Will a detail consist of multiple pages and do you want the addressability ( if there is such a word ) to the page level - OR - do you want to maintain a history of details.
If all you are saving is a DetailID etc, you may even just use SharedPreferences, rather than using the database.
You could use the lifecycle events like onCreate, onResume, onPause etc to track loading / unloading of details.
精彩评论