I wanted to create an add favorite function for my item in a list view. But i have no idea which approach i should use, either shared preferences or sqlite DB. Can any one give opinion regarding this?
Thanks
I wanted to create an add favorite function for my item in a list view. But i have no idea which approach i should use, either shared preferences or sqlite DB. Can any one give opinion regarding this?
Thanks
If you want to hold small data, like ID's or something, you should use
SharedPreferences- they're fast and easy to use. Keep it asStringwith ex. comma as separator or just useSet.If you want to hold big amount of structured, organized, data, keeping whole object, it would be better to use SQLite database. This is more complicated.
Remember both options are read/write operations, so they must not be done on main thread.