Re: [android-developers] Jelly Bean Crash with Bitmap Recycle "Sorry, an error has occurred: bitmap is recycled"

2012-07-16 Thread Streets Of Boston
The code below would fix an issue where a bitmap would have been recycled twice. This would not fix the issue where a bitmap would have been recycled where it should have never been recycled at all. BTW: the boolean expression (bitmap1 != bitmap2) or (bitmap1 == bitmap2) is very fast. It is jus

Re: [android-developers] Jelly Bean Crash with Bitmap Recycle "Sorry, an error has occurred: bitmap is recycled"

2012-07-16 Thread Francisco M. Marzoa Alonso
I have had the same problem with some devices, but I did not study the case in deep, just applied this workaround directly: if ( ! oldBitmap.isRecycled()) oldBitmap.recycle(); It may be faster than comparing one bitmap to another, but to be honest I did not try the other method. Regards, O

Re: [android-developers] Jelly Bean Crash with Bitmap Recycle "Sorry, an error has occurred: bitmap is recycled"

2012-07-15 Thread Craig Mitchell
Ah, yes, thanks Romain, that was it! Cheers. On Sunday, 15 July 2012 06:45:58 UTC+10, Romain Guy (Google) wrote: > > 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

Re: [android-developers] Jelly Bean Crash with Bitmap Recycle "Sorry, an error has occurred: bitmap is recycled"

2012-07-14 Thread Romain Guy
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 != oldBitm

[android-developers] Jelly Bean Crash with Bitmap Recycle "Sorry, an error has occurred: bitmap is recycled"

2012-07-14 Thread Craigo
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, new