0

I have a game in Android I want to Store and retrieve high score on ScoreBoard(maybe somewhere else). (store the highest score, for all user can see that, if could, i want to store 5 highest score) Where should i store and retrieve them , and how can i do it. Please help me.

Lex Nguyen
  • 401
  • 11
  • 23
  • 1
    Try ShapredPreference with firstTopScore,SecondTopStore,ThirdTopScore,FourthTopScore,FifthTopScore Keys with respective values Or a simple Json String with same values in Json format. – Lucifer Feb 25 '14 at 07:54
  • I'm newbie in this. so i do not know how to store like "World ranking" and where should i store this – Lex Nguyen Feb 25 '14 at 08:01
  • 1
    Check out this [example](http://www.tutorialspoint.com/android/android_shared_preferences.htm). Think that instead of 5 EditText's value, you want to store your Top 5 scores. – Lucifer Feb 25 '14 at 08:03
  • Kedarnath: i want to store them on the internet as leader board, then all user who play my game can see the highest score in the world – Lex Nguyen Feb 25 '14 at 08:08
  • 1
    Then I think you need to create a webservice with database. – Lucifer Feb 25 '14 at 08:09

1 Answers1

1

Basically there are 5 different way to saving your score which must be string

  1. Shared Preferences: Store private primitive data in key-value pairs.

  2. Internal Storage: Store private data on the device memory.

  3. External Storage: Store public data on the shared external storage.

  4. SQLite Databases: Store structured data in a private database.

  5. Network Connection: Store data on the web with your own network server.

Depends upon your requirement you have to save your string, if it just some string(In your case 5 scores) better go for sharedpreference here is a quick tutorial of how to do that

https://stackoverflow.com/a/3624311/1659523

Community
  • 1
  • 1
Shaji Thorn Blue
  • 589
  • 2
  • 9
  • 19
  • :Which way, will all my user who play my game can see that scores(I think it need network, about "Shared Preferences" please guide me more) – Lex Nguyen Feb 25 '14 at 08:04
  • 1
    yaa you are right, you need to use network connection for this so that all other user can see your score if iam not wrong you want to create leaderboard right?? – Shaji Thorn Blue Feb 25 '14 at 08:10
  • Yes, you are right, can i use some free service or i much create a webservice with database. – Lex Nguyen Feb 25 '14 at 08:11
  • 1
    There must be many services which provide you this, Even you can use facebook api, google play game services for that or you can create your own data base, i have not work in web services so i cant help you but you can read this https://developers.google.com/games/services/android/leaderboards – Shaji Thorn Blue Feb 25 '14 at 08:16