I am trying to load an array of 20 URLs in the background using Picasso. So far I have the following 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); }
And my target object is as follows:
Target target = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Log.d("GAME", "Image loaded" + ++test); gameImage.setImageBitmap(bitmap);
I want to preload images so that I can show one by one in ImageView every time the user clicks a button.
The first image loads so fast (that's cool), but other images in the for loop never load. How can i fix this? I need images to start loading in a for loop.
source share