Issue with Picasso library to fetch image from Firebase storage

26 Views Asked by At

I am trying to display user image from firebase storage to a CircleImageView but Piccaso does not show any image or sometimes the image holder gets disapeared.

Code to get image:

private String receiverUserID;
private CircleImageView userProfileImage;
private DatabaseReference UserRef;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);

    UserRef = FirebaseDatabase.getInstance().getReference().child("Users");

    userProfileImage = (CircleImageView) findViewById(R.id.visit_profile_image);

  
    receiverUserID = getIntent().getExtras().get("visit_user_id").toString();


    RetrieveUserInfo();
}

private void RetrieveUserInfo()
{
    UserRef.child(receiverUserID).addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot)
        {
            if((dataSnapshot.exists()) && (dataSnapshot.hasChild("image")))
            {
                String userStatus = dataSnapshot.child("status").getValue().toString();

                             Picasso.get().load(userImage).placeholder(R.drawable.profile_image).into(userProfileImage);
            }

Note: (Holder show the default image with no problem).

I want to get image in circle image view from firebase please help.

1

There are 1 best solutions below

0
Saad Waseem On

You're reading userStatus and loading userImage. You're also checking condition on image child and then loading status.