简单的方法,通过很多appstarts保存价值? [英] Easy way to save values through many appstarts?
问题描述
有没有办法通过一个应用程序的不同开始保存价值? 我需要保存一些数据(游戏的记录)。 在Objective-C我用UserDefaults,什么是它的Java? 如果可能的话,我想举一个简单的方法(一行code)。
一行code
没有,这是不会发生的。但是,如果你只是简单的数据并没有太大的,那么你可以使用的共享preferences
目前使用的共享preferences
的在这里的文档
但如果你将要存储大量数据的一个游戏,那么你可能要实施的的SQLite数据库
请参阅存储选项什么工作最适合你
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).
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.
这篇关于简单的方法,通过很多appstarts保存价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!