PaNaVTEC / DrawableView

A view that allows to paint and saves the result as a bitmap
http://panavtec.me
Apache License 2.0
585 stars 99 forks source link

Saving Background bitmap with drawn paint causes the app to crash? #16

Open imsocb opened 7 years ago

imsocb commented 7 years ago

Hi Chris, Sorry to bother you did not know have you read my previous post to you in another thread here https://github.com/PaNaVTEC/DrawableView/issues/6. Anyway, have been getting weird errors (double paint on the canvas and crashing the app) occurring when i press the save button that runs this code drawableView.obtainBitmap(bitmap); where i want to save the drawn paint together with the background image. Rather a newbie in android please tell me how I can solve this problem? Thank You

 java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@c6e04c3
                                                                                               at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1270)
                                                                                               at android.graphics.Canvas.drawBitmap(Canvas.java:1404)
                                                                                               at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:544)
                                                                                               at android.view.View.getDrawableRenderNode(View.java:16513)
                                                                                               at android.view.View.drawBackground(View.java:16449)
                                                                                               at android.view.View.draw(View.java:16261)
PaNaVTEC commented 7 years ago

can you provide a sample project with the bug? Happy to take a look