I create in a loop dynamically ImageView on the list of links to pictures. When you first start pictures are not displayed, when you restart displayed. What could be wrong and how to fix it?
It feels like while the pictures are loading, that they manage to fall asleep before displaying the pictures, and the second time it just takes from the cache: /
for (int z = 0; z < zCont.length; z++) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(100, 100); params.gravity= Gravity.LEFT; ImageView iv = new ImageView(this); iv.setScaleType(ImageView.ScaleType.FIT_XY); setImage(iv, "http://sait.ru/fotota/foto"+tel+".jpeg"); linearLayout.addView(iv, params); } private void setImage(final ImageView imageView, final String imgURL) { Picasso.with(this) .load(imgURL) .error(R.mipmap.ic_launcher) .into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Log.e("loaded", "onBitmapLoaded: loaded" ); imageView.setImageBitmap(bitmap); imageView.invalidate(); } @Override public void onBitmapFailed(Drawable errorDrawable) { Log.e("loaded", "onBitmapFailed: load failed" ); } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } }); }