简体   繁体   English

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

[英]How to get google account profile picture in android app

Iam using firebase google sign in in my project.我在我的项目中使用 firebase google 登录。 I want to display the account name, email and profile picture.我想显示帐户名称 email 和个人资料图片。 I can display the name and email without any problem but i can't able to display the users google account profile picture.我可以毫无问题地显示名称和 email,但我无法显示用户的谷歌帐户个人资料图片。 How do i do that.我怎么做。

according to Docs根据文档

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 
}

then you can use Picasso Library to show images in ImageView然后您可以使用毕加索库在 ImageView 中显示图像

Picasso.with(this).load(personPhoto).into(R.id.imageview);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取Gmail帐户的个人资料图片 - How to get profile picture of gmail account 我怎样才能收到正确的 url? 尝试从 firebase 应用程序中的 googlesignin 帐户获取个人资料图片 - How can I receive the correct url ? Trying to get the profile picture from the googlesignin account in firebase app 在Android上将Uri的Google+个人资料图片获取到位图 - Get Google+ profile picture from Uri to Bitmap on Android Android Firebase —存储Google个人资料图片 - Android Firebase — Storing Google Profile Picture 当用户使用其Facebook帐户登录时,如何获取用户的姓名,电子邮件和个人资料图片? - How do I get the user's name, email, and profile picture when the user logs in with their Facebook account? 从Facebook到Android应用的名称和个人资料图片 - Name and profile picture from Facebook into Android app 如何将图片从闪烁获取到Android应用程序? - How to get picture from flicker to android app? 如何在Android中将个人头像图片放置在该位置? - How to place profile picture image on that place in Android? 设置个人资料图片并保存在内部存储器文件夹中-Android应用 - Set profile picture and save in internal memory folder-android app 检索Google联系人个人资料图片 - Retrieve google contact profile picture
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM