Displaying Friends Scores

Now that players can add friends, you need to update QuizScoresActivity to populate the Scores of Friends tab with live data from the application server. Luckily, this feature is straightforward because the application server is the primary handler for friend relationships. Retrieving friends' scores is simply a slightly different query on the application server datastore.

Displaying friends' scores on the scores screen is handled exactly the same way as displaying the all-time-high scores, except that the application server URL for the data request includes the identifier of the player. The application server then knows you want to filter the scores to just those connected to that player.

From an implementation perspective, you can simply create another instance of ScoreDownloaderTask to retrieve these scores and populate the Scores of Friends tab (see Figure 17.4). When you have the scores screen working with live data, you can remove the mock XML resource files and any associated code from the project.

S HI <B 2:27 PM I

| Been There, Done That ftScores


All Scores

Scares of Friends

Usemame LiUle Fawn This Tiger

Ranking 1 2

Usemame LiUle Fawn This Tiger

Ranking 1 2


The Scores of Friends tab.

Was this article helpful?

0 0

Post a comment