我已經在這個論壇上看到過所有貼子,但是我還沒有找到任何東西。 如何在ImageView中顯示Google加上登錄我的應用的人的個人資料圖片?與ImageManager? 請問您能顯示一些代碼嗎?Google Plus個人資料圖片Google Play遊戲服務
0
A
回答
1
下面的方法做你想做的。
public class AvatarImage extends ImageView {
Bitmap image;
public static final String TAG = "AvatarImage";
public AvatarImage(Context context) {
super(context);
setImageResource(R.drawable.avatar);
}
/**
* This method takes the participant object and attempts to
* download avatar of the participant from google plus
* if this is unsuccesful default avatar is shown
* @param p
*/
public void setImageFromParticipant(Participant p) {
ImageManager im = ImageManager.create(getContext());
im.loadImage(this, p.getIconImageUri(), R.drawable.avatar);
try{
Bitmap bitmap = ((BitmapDrawable)this.getDrawable()).getBitmap();
setImageBitmap(bitmap);
}
catch(NullPointerException e)
{
e.printStackTrace();
}
}
}
0
如從約翰對方的回答中的代碼是正確的,但是,目前與谷歌Play業務圖書館這裏Google Issue Tracker所示爲使用版本庫中的10人(或許版本9的問題。 。版本8很好)。不幸的是,對於這個問題,如果您甚至嘗試獲取由ImageManager解碼的URI,Google Play服務將停止工作。要麼等待圖書館的下一個版本,要麼嘗試獲取版本8的版本號。 (我無法將此作爲對上述答案的評論,因此不得不用新的答案...)
相關問題
- 1. Android Google Play遊戲服務
- 2. Google Play遊戲服務
- 3. Google Play遊戲服務多人遊戲iOS和Android
- 4. Google Play遊戲服務實時多人遊戲
- 5. 如何從Google Plus獲取大型個人資料圖片?
- 6. libGDX Google Play遊戲服務 - Android
- 7. AndEngine with Google Play遊戲服務
- 8. Google Play遊戲服務和AdMob
- 9. Google Play遊戲服務註銷回調
- 10. Google Play遊戲服務登錄問題
- 11. Google Play遊戲服務在中國?
- 12. Google Play遊戲服務BaseGameUtils錯誤
- 13. Google Play遊戲服務無法啓動。
- 14. Google play遊戲服務 - 成就點
- 15. Google Play遊戲服務+模擬器
- 16. Unity3d Prime31 Google Play遊戲服務教程
- 17. Android Google Play遊戲服務startQuickGame,undefined makeBasicRoomConfigBuilder()
- 18. Google Play遊戲服務成就加載
- 19. Google Play遊戲服務createAutoMatchCriteria MIN_OPPONENTS> 1
- 20. sendReliableMessage自己? Google Play遊戲服務 - Android
- 21. 設置Google Play遊戲服務
- 22. 使用一個帳戶測試Google Play遊戲服務多人遊戲
- 23. 如何使用Google Play遊戲服務在RealTimeMultiplayer中獲取參與者的個人資料圖像
- 24. 是否可以解析Google+(Google Plus)個人資料頁面?
- 25. 我可以在Google+遊戲服務中將其Google+個人資料顯示給其他人嗎?
- 26. 在Android遊戲中配置不當的Google Play遊戲服務
- 27. Google Play遊戲服務可用於非遊戲
- 28. 登錄Google Play遊戲服務後遊戲崩潰
- 29. Google Play遊戲服務 - 使用AutoMatch的玩家人數最多
- 30. 允許多人登錄Google Play遊戲服務?
不工作這個代碼!你有其他解決方案嗎? – John95
對不起。這非常簡單,適用於我。如果您在將代碼集成到代碼時遇到問題,您應該更具體地瞭解它如何工作。所以我可以幫忙。 – user2259824
當我寫ImageHelper時出錯。我該怎麼辦? – John95