0

i am using Picasso to load images in my android app,but the the images i am fetching form server are very large, so is there any way to apply lazy loading using Picasso??

  • Lazy loading? Just wait calling `Picasso.with().into()` until the last moment you are able to - that's lazy loading. Or do you man something else? – TpoM6oH Jul 03 '17 at 11:48
  • do you mean that picasso use lazy loading by default?? –  Jul 03 '17 at 11:52

2 Answers2

2

I guess picasso has not a lazy load method or something like this.

You can add a callback with methods that success and error. With a small progressBar that over imageview, you can tell the user that image is loading. Then you can hide the progressbar on onSuccess and onError methods.

Picasso.with(getContext())
         .load(url)
         .into(imageView, new Callback() {
               @Override
               public void onSuccess() {

               }

             @Override
             public void onError() {

              }
        });
Özer Özcan
  • 1,253
  • 16
  • 17
0

if you are using picasso to load images in a recycler view the view will be created only when the view is on visible to user so if you use recycler view it automatically gets lazy loading this link may help you

Lazy load of images in ListView

nithin y.n.v
  • 158
  • 2
  • 14
  • i am using horizontal recycler View but it is taking too long to display the image –  Jul 03 '17 at 12:39
  • @user3913975 the images may be of large size why cant you use Glide instead of Picasso because glide loads images faster than picasso – nithin y.n.v Jul 04 '17 at 07:32