Issue
Hello I am trying to add a profile image in my application but it not showing the image I get this error I am also trying to add in user adapter it not showing also I can not the solve the problem thanks for answering thanks
the error message
2022-01-28 08:32:18.553 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.568 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.742 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
2022-01-28 08:32:18.785 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
here the my code
private void userInfo(){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Users").child(profileid);
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (getContext() == null){
return;
}
User user = dataSnapshot.getValue(User.class);
Glide.with(getContext()).load(user.getImageurl()).into(image_profile);
username.setText(user.getUsername());
fullname.setText(user.getFullname());
bio.setText(user.getBio());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
I use the hdodenhof:circleimageview version
implementation 'de.hdodenhof:circleimageview:3.1.0'
here the my layout code
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/image_profile"/>
Solution
I tried to open the resource from the link that I extracted from you log gs://travelinstam2.appspot.com/placeholder.png
but it failed.
Have you checked that the resource URL is correct and reachable?
Answer: According to our discussion in the comment section, the issue was with the URL provided to Glide.
Answered By - Kamal Nayan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.