Reputation: 2300
I want to store top 5 High score with username in shared preference. So I need to store to value at the same time, user name and the value. But I found preference only allow one value with a key. So my question is how I can store top 5 values with username in a shared preference. Thanks in advance
Upvotes: 0
Views: 3091
Reputation: 4259
If you're struggling with shared preferences I'd recommend this tutorial - it covers everything you need to know about Shared Preferences with a practical example.
Having said that, I my opinion I think you'd be better off using an SQLite database. If you are interested in using a database this is a good read:
Upvotes: 2
Reputation: 10039
You can store the high scores in shared preferences as a list. This might help you out -http://stackoverflow.com/questions/3876680/is-it-possible-to-add-an-array-or-object-to-sharedpreferences-on-android
Check out the first answer.
Upvotes: 0
Reputation: 24722
top name
and top value
User/50
Upvotes: 1