0

Warning: I’m extremely new to coding/game design; please bear with me. :D

Overview: I’m using SharedPreferences to save an Int representing the Player’s high score. It’s fully functioning, and I can display and update the value within the main game loop. BUT, I’d like to display the player’s current high score on the main menu (The idea is when the player returns to the app, they’ll see their current high score).

Question: How can I display the user’s high score Int value on the main menu screen? I’m assuming I’d have to have the XML call a variable within the onCreate method of my main menu class? If so, what would that XML look like as well as its respective code in the class?


Again, this is my first time coding. I felt comfortable in Java until I needed an XML component. I think after I have a better grasp on how XML functions, I should be able to run with it, so any insight (even small) would be great.

Thanks! Joe

JoeFNewb
  • 1
  • 2
  • Go through http://developer.android.com/guide/topics/data/data-storage.html#pref Quite easy actually. – SachinGutte Apr 09 '14 at 03:42
  • Thanks Sachin! But I don't see any XML references on that page. I know how to save/retrieve the Int, I'm just trying to display it on the main menu. – JoeFNewb Apr 09 '14 at 03:55
  • Can you please refer this [Link][1] [1]: http://stackoverflow.com/a/3624358/3469370 – empr777 Apr 09 '14 at 03:55
  • YESSSSSS! The final comment in that thread had EXACTLY what I was looking for! http://stackoverflow.com/a/16684961/3513388 I've already got the high score showing on my main menu now! Now I know a lot more about XML and a better appreciation for searching StackOverflow. Thanks a million empr7777!!! – JoeFNewb Apr 09 '14 at 04:14

0 Answers0