is there a way to save values through various starts of an app? I need to save some statistics (records of a game). In objective-c I used UserDefaults, what's it in Java? If possible I'd like to take a simple way (one line of code).
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
one line of code
No, that's not going to happen. But if you just have simple data and not much of it then you can use SharedPreferences
There is a good, basic example of using SharedPreferences
here in the docs
But if you are going to be storing a lot of data for a game then you probably want to implement an SQLite DB
See Storage Options for what will work best for you.