O
O
Orkhan Hasanli2018-04-27 10:04:23
Java
Orkhan Hasanli, 2018-04-27 10:04:23

How to implement "list of favorites" in java & android?

Good day!
I decided to write a small application in java to improve my skills. I would like to find an answer to the following question. There is a sqlite database with a list of information. Information can be added to the "list of favorites". How exactly to implement this list so that the data can be loaded the next time the application is opened and that the data is not lost when the application is updated? How and where to store this information?
Possible ideas -
1) Create an ArrayList and add the id of this information, serialize and write to a separate file.
2) Create a column isSelected (bool) and each time load from the database (then, in theory, the application should also write information to the database). And how then will it affect updates (the database will also be updated)
3) Create a separate table in the database
Thanks in advance for the information.
PS for example, in this source: https://stackoverflow.com/questions/7957319/how-to... it is recommended to create a separate table in the database

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Codebaker, 2018-04-29
@azerphoenix

Separate table using FOREIGN KEY (ON DELETE CASCADE) Details here, keyword search

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question