I'm using Glide 4.7.1 trying to resize and save some photos.
for (String path : this.paths) {
Glide.with(this.context).asBitmap().load(path).apply(RequestOptions.fitCenterTransform()).into(new SimpleTarget<Bitmap>(1080, 1920) {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
try {
resource.compress(Bitmap.CompressFormat.JPEG, 85, new FileOutputStream(MasterFacade.getAppDir() + "temp/" + resource.hashCode() + ".jpg"));
listener.onUpdate(progressMessage, processed.get());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
});
}
I just want to resize (keeping aspect ratio) to 1080x1920 (or the nearest) and then save the new bitmap to a file.
I'm sure I've permission to write
I'm sure the path
image exists
I'm sure MasterFacade.getAppDir() + "temp/" + resource.hashCode() + ".jpg"
is a valid dir and I've writing permisions on it
But this code is never reached!
I tried to debug and onResourceReady
never is called...
What am I doing wrong?