开发者

Shared Preferences and highschore/Level select

开发者 https://www.devze.com 2023-03-05 10:54 出处:网络
I\'m trying to create a level select / high-score screen before launching a game.The layout is set to be a 2 column view, with the level # and the high-score as individual textviews.I\'m able to estab

I'm trying to create a level select / high-score screen before launching a game. The layout is set to be a 2 column view, with the level # and the high-score as individual textviews. I'm able to establish this setup with data and populate manually but cannot seem to accomplish it using preferences. Should I bother with this or skip it and go for a database app开发者_如何学Croach? (will be ~60 levels, only keeping track of the highest high-score)

Any help with this combination? It may be that I don't understand the preferences enough but I haven't found any code or explanations that seem to resonate with me and what I'm trying to accomplish.


If you just want to store the highest score and the level number where you reached it, SharedPreferences is fine and much easier to handle.

If you have only few and very simple data, than SharedPreference is the right place to store them...


Shared preferences are going to be a lot easier than going the DB route. With so little to store, it should be a breeze. Check out the simple google example.

0

精彩评论

暂无评论...
验证码 换一张
取 消