Is there a way by which we can detect that images are being loaded from the cache in picasso?

as a title, I want to check whether images are loaded from the cache or not.

I did something similar, but could not.

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, whoever has the test version, then tell me. Thanks.

+1
source share
1 answer

Use Picasso setIndicatorEnabled(true) to determine where to load the image.

 Picasso picasso = Picasso.with(context); picasso.setIndicatorsEnabled(true); //... picasso.load("http://example.com/image.jpg").into(myImageView); 

enter image description here

A colored ribbon will appear in the upper left corner.

  • Red: network
  • Yellow: drive
  • Green: memory

Source: Picasso - Debug Indicators

+4
source

Source: https://habr.com/ru/post/1241362/


All Articles