List<Player> attachedPlayers = (List<Player>)query.execute();
List<Player> players = detachList(pm, attachedPlayers);
if (players != null) {
String[] result = new String[players.size()];
for (int i = 0 ; i < result.length ; i++) {
Player player = players.get(i);
if (player.getFacebookUser() != null && player.getFacebookUser().equals("true")) {
String facebookPhotoElement = "<a href='http://facebook.com/" + player.getUserId() + "' target='_blank'><img src='http://graph.facebook.com/" + player.getUserId() + "/picture'" + "height='50' width='50'/></a>";
result[i] = (i+1) + ") " + player.getNickname() + " : " + player.getHighscore() + "<br>" + facebookPhotoElement;
}
else {
result[i] = (i+1) + ") " + player.getNickname() + " : " + player.getHighscore();
}
}
pm.close();
return result;
}