I'm creating a bitmap, but after that, I'm creating another one with a scale:
Bitmap originalBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.a1);
float ratio = (float) originalBitmap.getWidth() / originalBitmap.getHeight();
int h = sh/7;
int w = (int) (h * ratio);
scaledBitmap = Bitmap.createScaledBitmap(originalBitmap, w, h, true);
originalBitmap.recycle();
It is safe to recycle originalBitmap
after creating scaled Bitmap? The original bitmap will not be used, only the scaled Bitmap will be used.
I'm asking it because I had a comment in that line that tells about past "Recycled Bitmap" crashes, but I don't know in which circumstances. Maybe recycling the original one can generate crashes in the scaled version?