Android: Picasso load image failed . how to show error message
Use builder:
Picasso.Builder builder = new Picasso.Builder(this);
builder.listener(new Picasso.Listener()
{
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception)
{
exception.printStackTrace();
}
});
builder.build().load(URL).into(imageView);
Edit
For version 2.71828 they have added the exception to the onError callback:
Picasso.get()
.load("yoururlhere")
.into(imageView, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
}
})
Picasso Library, Android: Using Error Listener
Picasso 2.0 allows you to attach a callback into a request.
https://github.com/square/picasso
The callback you are using is for "global" listener and it helps you debug errors that potentially happen due to a network load.
Use load(url).into(view, new Callback() {...});
in Picasso 2.0.
Remember to invoke cancelRequest(target)
if you are using a Callback
.
Picasso fails to load an image but provides no error message?
This issue was solved by switching from Picasso to Glide. Worked on all of my test devices. I know my original question was relatively generic, but if you're encountering the same thing (picasso won't load your image and won't print an error) see if using a different library will help. Glide is very similar.
First time error loading picture with Picasso
The problem was solved in the Picasso 2.3.0.
The fix is in the Picasso changelog:
Requests will now be automatically replayed if they failed due to network errors.
I hope this save you many hours.
Related Topics
Android: How to Change the Actionbar "Home" Icon to Be Something Other Than the App Icon
Generate Barcode Image in Android Application
Save Sensitive Data in React Native
Error: Execution Failed for Task ':App:Clean'. Unable to Delete File
How Do We Distinguish Never-Asked from Stop-Asking in Android M's Runtime Permissions
Android Alert Dialog with One, Two, and Three Buttons
Android Accelerometer Not Working When Screen Is Turned Off
How to Correctly Use Google Plus Sign in with Multiple Activities
Filter Output in Logcat by Tagname
Login Error: There Is an Error in Logging You into This Application. Please Try Again Later
Cache.Properties (The System Cannot Find the File Specified)