Rogeres Oliveira
Rogeres Oliveira

Reputation: 11

What's the best way of saving variables status before closing an app

For example:

I have a game of clicking in objects, so there are variables like

openDoor = true;
openChest = false;

When user close window and restart the game I have to return him/her with his/her progress.

What should I do?

Study Text file? Save on Database?

Put some code in somewhere to save the status?

Upvotes: 0

Views: 56

Answers (1)

Pranay Soni
Pranay Soni

Reputation: 403

If the data you need to store is quite small or less than I would recommend you to use SharedPreference. It is the best practice to use this when you need to store the user's status. SharedPreference are quite private so your data won't be accessible to other apps. You can go through this.

Upvotes: 1

Related Questions