使用imageview显示谷歌玩游戏服务播放器图像

时间:2015-09-25 05:37:33

标签: android google-play google-play-services google-play-games leaderboard

我正在使用Google Play游戏服务,并且我正在使用此代码来获取玩家详细信息。

if (gamesClient != null) {
        Games.Leaderboards.loadCurrentPlayerLeaderboardScore(gamesClient, 
                activity.getString(R.string.leaderboard_high_score), 
                LeaderboardVariant.TIME_SPAN_ALL_TIME, 
                LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {

            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult result) {
                // TODO Auto-generated method stub
                LeaderboardScore lbs = result.getScore();
                int score = (int) lbs.getRawScore();
                String name = lbs.getScoreHolderDisplayName();
                Uri urlimage = lbs.getScoreHolderHiResImageUri();
                Uri urlicon = lbs.getScoreHolderIconImageUri();
                Log.e("tag", "name: "+name+"\nscore: "+score+"\nurlimage: "+urlimage+"\nurlicon: "+urlicon);
            }
        });
} else {
            //Login
}

但是我在这里获得了像&#34;内容://com.google.android.gms.games.background/images/33407107/22" 有了这个如何在我的应用程序中使用图像视图显示配置文件图像请帮助我。 谢谢..

1 个答案:

答案 0 :(得分:2)

我使用像这样的ImageManager尝试:

    Uri icon = Games.Players.getCurrentPlayer(googleApiClient).getIconImageUri();

    ImageManager manager = ImageManager.create(this);
    manager.loadImage(photo, icon);

我还没有在LeaderboardScore上尝试过,但我认为它会是一样的。因为Uri格式相同content://com.google.android.gms.games.background/blablabla