Loading multiple images with Picasso on background

Fernando Santiago

I am trying to get loaded an array of 20 urls in background with Picasso. So far i have the next code:

Log.d("GAME", "Loading all images");
for (int i = gamePieces.length-1; i >= 0; i--) {
   GamePiece p = gamePieces[i];
   Log.d("GAME", "I will load " + p.getImage());
   Picasso.with(context).load(p.getImage()).into(target);
}
//loading the first one
Picasso.with(context).load(piece.getImage()).into(target);

And my target object is the next one:

Target target = new Target() {
       @Override
       public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
           Log.d("GAME", "Image loaded" + ++test);
           gameImage.setImageBitmap(bitmap); //ImageView to show the images
       }

       @Override
       public void onBitmapFailed(Drawable arg0) {}

       @Override
       public void onPrepareLoad(Drawable arg0) {}
   };

I want to pre load the images so i can show one by one in the ImageView any time the user clicks a button.

The first image is loading so fast(that's cool) but the other images at the for loop never get load. How can i fix this? i need the images to start loading in the for loop.

Fernando Santiago

I had to use: Picasso.with(getActivity().getApplicationContext()).load(p.getImage()).fetch();

Here is the reference: https://square.github.io/picasso/2.x/picasso/com/squareup/picasso/RequestCreator.html

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Show an "Loading..." image while background loading of image with Picasso

From Dev

Picasso Images not loading in a GridView

From Dev

Large images (from file) not loading in Picasso, no obvious error seen

From Dev

Picasso loading duplicate images

From Dev

Slow Loading big images with Picasso

From Dev

Picasso library is not loading images from the server correctly in a listview

From Dev

Picasso image loading previously cached images

From Dev

Loading large background images

From Dev

background images not loading in Firefox

From Dev

Loading Images With Picasso From The Internal Storage

From Dev

Android : Picasso is not loading some images

From Dev

Picasso Images are not loading in Gridview Android

From Dev

Load multiple images with picasso - Android

From Dev

Loading multiple images into multiple canvases

From Dev

Loading images from disk with picasso, does it cache it?

From Dev

Webpack - background images not loading

From Dev

How to specify multiple fallback images with Picasso?

From Dev

Picasso Images are loading slow in android, why?

From Dev

Picasso Images are loading slow in android, why?

From Dev

Show an "Loading..." image while background loading of image with Picasso

From Dev

Picasso Images not loading in a GridView

From Dev

Images not loading using Picasso no error given

From Dev

Picasso is not loading the images from url with custom adapter

From Dev

Multiple images with VisualBrush as background

From Dev

Picasso isn't loading scrolled images efficiently?

From Dev

How to specify multiple fallback images with Picasso?

From Dev

Get multiple images as background

From Dev

positioning multiple background images

From Dev

CSS Multiple background Images

Related Related

  1. 1

    Show an "Loading..." image while background loading of image with Picasso

  2. 2

    Picasso Images not loading in a GridView

  3. 3

    Large images (from file) not loading in Picasso, no obvious error seen

  4. 4

    Picasso loading duplicate images

  5. 5

    Slow Loading big images with Picasso

  6. 6

    Picasso library is not loading images from the server correctly in a listview

  7. 7

    Picasso image loading previously cached images

  8. 8

    Loading large background images

  9. 9

    background images not loading in Firefox

  10. 10

    Loading Images With Picasso From The Internal Storage

  11. 11

    Android : Picasso is not loading some images

  12. 12

    Picasso Images are not loading in Gridview Android

  13. 13

    Load multiple images with picasso - Android

  14. 14

    Loading multiple images into multiple canvases

  15. 15

    Loading images from disk with picasso, does it cache it?

  16. 16

    Webpack - background images not loading

  17. 17

    How to specify multiple fallback images with Picasso?

  18. 18

    Picasso Images are loading slow in android, why?

  19. 19

    Picasso Images are loading slow in android, why?

  20. 20

    Show an "Loading..." image while background loading of image with Picasso

  21. 21

    Picasso Images not loading in a GridView

  22. 22

    Images not loading using Picasso no error given

  23. 23

    Picasso is not loading the images from url with custom adapter

  24. 24

    Multiple images with VisualBrush as background

  25. 25

    Picasso isn't loading scrolled images efficiently?

  26. 26

    How to specify multiple fallback images with Picasso?

  27. 27

    Get multiple images as background

  28. 28

    positioning multiple background images

  29. 29

    CSS Multiple background Images

HotTag

Archive