I’m working on book app, when the user clicks on a book on the list, my app gives the option to add that book to favorites.so the user can view the favorite books
but I don’t know how to implement that..
I’m working on book app, when the user clicks on a book on the
Share
Your question is a bit vague. I see two open questions here:
For 1:
Just have your activity listing the books implement the corresponding event listener. See here: Android Doc – Input Events
For 2:
Depends on the amount of data you want to store if it is just a list of favorite book names Preferences might do. If you want to kep the option to extend the stored list with details fo each book then a SQLite database is your choice.
There is an Android Tutorial on how to persist data as well:
See here: Android Doc – Data Storage
And here we have a tutorial “Creating and using databases in Android“.