I want to implement a “save“ option on cardview items. I want to know how can I cache/save a cardview so I still can interact with it even if it has been remove from database hence updated in the UI tab but still accessible locally in the SAVED tab.
Asked
Active
Viewed 47 times
1 Answers
2
If it's gone from the DB, then it's gone gone. You'd have to spin up a local Room instance or something which won't work anyway when the user tries to use your app on another device. A much simpler solution would be to simply enable offline persistance.
Does that answer your question? I wasn't quite sure what you meant by available "locally." ♂️

SUPERCILEX
- 3,929
- 4
- 32
- 61
-
Thanks for replying. Even if I enable offline persistence as soon as I update the database and user get online it will sync. I want to save it so it became Independent from the database. I'll upload a picture – Dr4ke the b4dass May 21 '18 at 00:42
-
Ah, why do you want something to stay on the device when it's deleted from the database? Seems like simply setting a boolean property to stop showing it wherever you don't want it would be easier. – SUPERCILEX May 21 '18 at 00:44
-
The heart button on each cardview in the UI is a favorite button, it suppose to make the cardview accessible from the "SAVED" tab, the last tab in the UI. – Dr4ke the b4dass May 21 '18 at 01:08
-
I now agree if it's not in the database, it's useless to store it somewhere. But the situation is: a tab full of cardview, and user want to save a few as favorite so those favorite cardview can be shown in a different Tab. – Dr4ke the b4dass May 21 '18 at 01:18