How do I keep the check box from disappearing when I turn off the app?

Asked 2 years ago, Updated 2 years ago, 56 views

I am creating an app to introduce videos.

I would like to check the check box for videos that users like, so that they can keep the check status even if they close the app.

The XML file allows you to display a check box, but how do I include the above features?

The development environment is Android Studio and the language is Java.

android

2022-09-30 21:22

1 Answers

There are several ways, but using DB is the best way.

For example, create and manage your favorite tables.

Once checked, insert it into your favorite table.
If unchecked, remove it from the Favorites table.
If you restart the app, check the check box of the videos in the Favorites table in the initial display.

There are several DB libraries, so please refer to here to choose one that is easy to use.
I personally recommend Realm.


2022-09-30 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.