I'm fetching a remote image and I want to have two different Bitmaps
but I'm not sure how to without fetching the image twice. If I use this code:
asyncTask(new GetRemoteImage(), (remoteImage) -> {
Bitmap darkImage = darkImage(remoteImage);
});
private static Bitmap darkImage(Bitmap bm) {
if (bm != null) {
Canvas canvas = new Canvas(bm);
canvas.drawARGB(175, 0, 0, 0);
canvas.drawBitmap(bm, new Matrix(), new Paint());
}
return bm;
}
Both the remoteImage
and darkImage
are darkened. I'm not 100% sure but I'm guessing there's only one reference to remoteImage
and darkImage
points to remoteImage
.
I can run the asyntask twice to get another image but not sure if there's a better way.