问题
as title suggest I want to check whether images are loading from cache or not.
I've done something like this but couldn't succeeded.
Picasso.with(getApplicationContext())
.load(data.get(position).get("product_image"))
.into(viewHolder.imgViewIcon, new Callback() {
@Override
public void onSuccess() {
viewHolder.imgViewIcon.setVisibility(View.VISIBLE);
if (Picasso.LoadedFrom.NETWORK != null)
YoYo.with(Techniques.ZoomIn).duration(1200)
.playOn(viewHolder.imgViewIcon);
viewHolder.placeholder.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
Please anyone have batter option then tell me. Thanks.
回答1:
Use Picasso's setIndicatorEnabled(true)
to detect where the image is loaded from.
Picasso picasso = Picasso.with(context);
picasso.setIndicatorsEnabled(true);
//...
picasso.load("http://example.com/image.jpg").into(myImageView);
A colored ribbon will appear in the top left corner.
- Red: network
- Yellow: disk
- Green: memory
Source: Picasso - Debug Indicators
来源:https://stackoverflow.com/questions/34915704/is-there-any-way-from-which-we-can-detect-images-are-loading-from-cache-in-picas