Ah, this is an interesting bug that we ran into ourselves. createScaledBitmap() can return the *same* bitmap if the scaled copy would have the same dimensions as the original image. The proper way to do this is to write:
bitmap = Bitmap.createdScaledBitmap(oldBitmap, etc...); if (bitmap != oldBitmap) oldBitmap.recycle(); On Fri, Jul 13, 2012 at 6:42 AM, Craigo <[email protected]> wrote: > Hi Google, > > My app that has been running for over 2 years without an update, finally > broke with Jelly Bean. The error: "Sorry, an error has occurred: bitmap is > recycled". > > The problem was with calling recycle on a bitmap: > > Bitmap bitmapOld = bitmap; > bitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, false); > bitmapOld.recycle(); > > Note: I never referenced bitmapOld again. > > The fix was easy, I just don't recycle any more. However, it seems odd > that this would have broken. Maybe creating the scaled bitmap shares > memory with the unscaled bitmap? > > Anyway, hopefully this information is useful to someone. > > Cheers, and keep up the excellent work! > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer [email protected] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

