使用ImageView显示Google Play游戏服务玩家图像 [英] Displaying google play game services player image using imageview
问题描述
我正在使用Google Play游戏服务,并且正在使用此代码来获取玩家详细信息.
I'm working with Google play game services and I'm using this code to get player detail.
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
}
但是在这里我得到了个人资料图片链接,例如"content://com.google.android.gms.games.background/images/33407107/22" 这样,我如何使用图像视图在我的应用程序中显示个人资料图像,请帮助我. 谢谢..
but here I'm getting profile image link like "content://com.google.android.gms.games.background/images/33407107/22" with this how can I show profile image in my application using image view please help me. thank you..
推荐答案
我像这样使用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
I haven't tried it yet on LeaderboardScore
, but I think it will be same. since the Uri format is same content://com.google.android.gms.games.background/blablabla
这篇关于使用ImageView显示Google Play游戏服务玩家图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!