[英]How to get google account profile picture in android app
我在我的項目中使用 firebase google 登錄。 我想顯示帳戶名稱 email 和個人資料圖片。 我可以毫無問題地顯示名稱和 email,但我無法顯示用戶的谷歌帳戶個人資料圖片。 我怎么做。
根據文檔
GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
String personName = acct.getDisplayName();
String personEmail = acct.getEmail();
Uri personPhoto = acct.getPhotoUrl(); // this line to get profile picture
}
然后您可以使用畢加索庫在 ImageView 中顯示圖像
Picasso.with(this).load(personPhoto).into(R.id.imageview);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.