2

Below is my Firebase structure image,

Firebase Structure

enter image description here

I will like to use the name and profile image of user for my Second Activity.

Here how I did for my another app,

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String uid = user.getUid();
String name = user.getDisplayName();

And I later used the name in my TextView to use the current user name but here it didn't worked and besides I also needed the profile image too.

So, How do I get the user image and name from above Firebase structure image to my Second activity layout TextView and ImageView and set the default text name and image if it returns null.

I tried below but it didn't worked to

public void setUserData(String name, String image) {

    ImageView userimage = (ImageView) findViewById(R.id.imageView);
    userimage.setImageURI(userimage);
}
Dumbo
  • 1,630
  • 18
  • 33
Hrithik Rawal
  • 47
  • 1
  • 7

2 Answers2

0

Your url is a string not Uri. So, you need to fetch the image from the given url.

You can use AsyncTask like: link

or use Glide library to make async calls. Glide

Anand Kumar
  • 1,439
  • 1
  • 15
  • 22
0

get userRecord by calling getUserAsync(String uid)

https://firebase.google.com/docs/reference/admin/java/reference/com/google/firebase/auth/UserRecord

Azay Gupta
  • 281
  • 2
  • 16