Java. lang. IllegalArgumentException: pointerIndex out of rang

Source: Internet
Author: User
Tags gety

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.