I have about 200 images in my web storage. When I try to download them with Picasso, I get only about 30 of them. I checked many cases and every time I get the different quantity of images and images are different too. LogCat said that getPicassoImage() always called, but onBitmapLoaded() called only about 30 times and never called onBitmapFailed().
In LogCat I also saw (After first click - first warning and I can't get at least 1 image. This always on the first click):
W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.A system to android.provider.Settings.Global, returning read-only value.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'path' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
void getPicassoImage(final String imageName){
Log.d("myLogs", "try to get "+ imageName);
Target target = new Target() {
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
/*Log.d("myLogs", "onBitmapLoaded");*/
try {
File file = new File(IMAGE_PATH + imageName);
FileOutputStream outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
outputStream.flush();
outputStream.close();
Log.d("myLogs", imageName + " image saved");
} catch (Exception e) {
Log.d("myLogs", "Picasso error");
}
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
Log.d("myLogs", "onBitmapFailed");
}
};
/*Log.d("myLogs","Load from " + storageUrl + imageName);*/
Picasso.with(getApplicationContext()).load(storageUrl+imageName).into(target);
}