gcacace / android-signaturepad

A custom Android View for drawing smooth signatures
Apache License 2.0
2.76k stars 641 forks source link

Library sometimes crashes during start of the activity when it is placed. #179

Open fkulik opened 8 months ago

fkulik commented 8 months ago

Android 8.1.0 Crash occurs in listener, is there any way to prevent it?

Fatal Exception: java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:1013) at android.graphics.Bitmap.createBitmap(Bitmap.java:980) at android.graphics.Bitmap.createBitmap(Bitmap.java:930) at android.graphics.Bitmap.createBitmap(Bitmap.java:891) at com.github.gcacace.signaturepad.views.SignaturePad.ensureSignatureBitmap(SignaturePad.java:573) at com.github.gcacace.signaturepad.views.SignaturePad.setSignatureBitmap(SignaturePad.java:243) at com.github.gcacace.signaturepad.views.SignaturePad$1.onGlobalLayout(SignaturePad.java:274) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:945) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2299) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1441) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6840) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966) at android.view.Choreographer.doCallbacks(Choreographer.java:778) at android.view.Choreographer.doFrame(Choreographer.java:713) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6518) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

kojofosu commented 8 months ago

Having same issue. But this happens when you set the visibility of the signature pad to GONE

fkulik commented 8 months ago

Unfortunately I didn't set visibillity for signature pad