My application crashed when i click the clear option (code for clear is mpath.clear(); invalidates();)

41 views Asked by At

The app is crashing without clearing the canvas. android studio 3.3.2

public void clearCanvas() {mPath.reset();invalidate();}

I expect to clear the canvas. without crashing

1

There are 1 answers

0
Loc Le Xuan On

You should share the crash log. In mostly case, you can find the reason of crash when you use try-catch block. You should try it, if you can't resolve it, you can ask more things in here.

In this case, you should check if your 'mPath' is null. (NullPointerException)