This exception occurs when the multi-touch zoom-in or zoom-out operation is performed on the image you have drawn. This error does not occur if the image is zoomed-in or zoomed-out.
This bug is caused by the Android system, so the first method is:
Modify the android_view_MotionEvent_nativeGetAxisValue method of frameworks \ base \ core \ jni \ android_view_MotionEvent.cpp
Comment out
[Java]
If (! ValidatePointerIndex (env, pointerIndex, pointerCount) {return 0 ;}
After the change, you need to re-compile the entire system, and then replace the lib library. It usually takes more than half an hour to re-compile the entire system. This method is quite troublesome.
The second method is to capture the IllegalArgumentException (invalid parameter exception) exception, as shown in
[Java]
Private float spacing (MotionEvent event ){
Try {
X = event. getX (0)-event. getX (1 );
Y = event. getY (0)-event. getY (1 );
} Catch (IllegalArgumentException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
}
The second method is simple and effective.