Reputation: 834
I'm using the Picasso library from Square to load a URL string into an ImageView. I'm calling this several times on an array or URLs with a Timer to change the ImageView image.
The first time though, when Picasso is loading the URL content, every time the ImageView updates, it flashes white.
After Picasso caches the content, the ImageView changes without the flash.
How do I stop the ImageView from flashing white?
Picasso.with(getApplicationContext()).load(currentUrl).into(img, new Callback() {
@Override
public void onSuccess() {
mProgress.dismiss();
}
@Override
public void onError() {
mProgress.dismiss();
}
});
Upvotes: 6
Views: 3172
Reputation: 26
ImageView iv = findViewById(R.id.iv);
Picass().get()
.load("Image Url")
.noPlaceHolder()
.into(iv);
Upvotes: 0
Reputation: 310
Had the same issue, solved it by adding the noPlaceHolder instruction like this :
Picasso.with(getApplicationContext())
.load(currentUrl)
.noPlaceholder()
.into(img, new Callback() {
@Override
public void onSuccess() {
mProgress.dismiss();
}
@Override
public void onError() {
mProgress.dismiss();
}
});
By default, Picasso will either clear the target ImageView in order to ensure behavior in situations where views are recycled. This method will prevent that behavior and retain any already set image.
Upvotes: 22