繁体   English   中英

如何在 android 应用程序中获取 google 帐户资料图片

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM