简体   繁体   中英

How to get google account profile picture in android app

Iam using firebase google sign in in my project. I want to display the account name, email and profile picture. I can display the name and email without any problem but i can't able to display the users google account profile picture. 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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