Loading multiple images with Picasso on background
10,091
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
Author by
Fernando Santiago
Updated on June 04, 2022Comments
-
Fernando Santiago about 2 years
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.
-
Biswajit Panday about 6 yearsReference Link is Dead.