The next thing would be to have your LeaderboardScreen extract the top 5 scores and display them. Again you should check for availability of storage (that user is logged in and server is available). If not, display a message indicating that the user needs to log in to view leaderboard. Otherwise, loop through the top 5 scoring UserInfo objects using a for-each loop. This all goes in the LeaderboardScreen constructor and would be similar to the following (except for how you display the information):
if (!UserInfo.isStorageAvailable())
{
System.out.println("You must be logged in to view leaderboard");
}
else
{
for (Object obj : UserInfo.getTop(5)) // for each of the top 5 scoring users
{
UserInfo user = (UserInfo)obj; // the UserInfo object of a top 5 scorer
String username = user.getUserName(); // the name of the user
int score = user.getScore(); // the high score of the user
int rank = user.getRank(); // the rank of the user
// display information (below is just to terminal for testing)
System.out.println(""+rank+") "+score+" "+username);
}
}
