biokys / cropimage

Replacement for deprecated official Android crop image function
555 stars 292 forks source link

Trying to recycle Bitmap #27

Open ManojMM026 opened 11 years ago

ManojMM026 commented 11 years ago

Hi i am getting strange exception when i take picture from camera and try to crop it. Here is my log cat.

I am facing this issue on Galaxy Grand with os 4.2.2

11-25 17:44:28.909: E/AndroidRuntime(30645): FATAL EXCEPTION: Thread-6510 11-25 17:44:28.909: E/AndroidRuntime(30645): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@42765a00 11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1026) 11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Canvas.drawBitmap(Canvas.java:1096) 11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Bitmap.createBitmap(Bitmap.java:646) 11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:558) 11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:564) 11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:271) 11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175) 11-25 17:44:28.909: E/AndroidRuntime(30645): at java.lang.Thread.run(Thread.java:856)

hjkatz commented 10 years ago

I ran into this exact problem simply add this to the prepareBitmap() method, after checking for null add this:

if( mBitmap.isRecycled() ) { mBitmap = getBitmap( mImagePath ); }

Good luck!

yundddd commented 9 years ago

Thanks, I have exactly the same problem.