Define this inner class in your java file:
public class Leaderboard implements ResultCallback<Leaderboards.LoadPlayerScoreResult> {
private Leaderboard(String id) {
leaderboardId = id;
}
private String leaderboardId = "";
@Override
public void onResult(LoadPlayerScoreResult arg0) {
// TODO Auto-generated method stub
System.out.println(leaderboardId);
}
}
Now use this code:
for (int i = 0; i < 25; i++) {
Games.Leaderboards.loadCurrentPlayerLeaderboardScore(getApiClient(), getString(LEADER_BOARDS[i]),
LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC)
.setResultCallback(new Leaderboard(getString(LEADER_BOARDS[i])));
}
Now let me explain how this works a little. The Leaderboard class implements ResultCallback so it's used in the setResultCallback method after you get the score for the player. Now, in the for loop, each call to get a score is having a different object of class leaderboard being set as the result callback, and each object is being given the unique leaderboard id which is being saved in the class using the constructor, and as you can see in the class, there is a method that will give you the leaderboardid back in the onresult.