Reprint Please specify: HTTP://BLOG.CSDN.NET/AAAWQQQ
Android Java.lang.IllegalArgumentException:pointerIndex out of range
Bug
11-27 00:12:55.029:e/androidruntime (22447): Java.lang.IllegalArgumentException:pointerIndex out of range11-27 00:12:55.029:e/androidruntime (22447): at android.view.MotionEvent.nativeGetAxisValue (Native Method)
Reason
When drawing, multi-touch zoom out leads to a
I'm in the Viewpager. Zooming in and out by hand-drawn images caused this bug.
My solution for Viewpager:
1 Inherit view
2 rewrite dispatchtouchevent
3 Catch exception
public class Fixedviewpager extends Viewpager {public Fixedviewpager (context context) { super (context); } Public Fixedviewpager (context context, AttributeSet Attrs) { Super (context, attrs); } @Override Public Boolean dispatchtouchevent (motionevent ev) { try { return super. dispatchtouchevent (EV); } catch (IllegalArgumentException ignored) { } catch (ArrayIndexOutOfBoundsException e) { } return false; }}
There are other ways online such as:
Overriding the Onintercepttouchevent and Ontouchevent methods
Try catch the two methods, which are shaped as follows:
Try{super.onintercepttouchevent (motionevent ev)} catch (IllegalArgumentException ex) {}return false;try{ Super.ontouchevent (motionevent ev)} catch (IllegalArgumentException ex) {}return false;
Reference: http://nanjingjiangbiao-t.iteye.com/blog/1794478
//┏┓┏┓//┏┛┻━━━┛┻┓//┃┃//┃━┃//┃┳┛┗┳┃//┃┃//┃┻┃//┃┃//┗━┓┏━┛//┃┃ God beast bless//┃┃ Code No bug! //┃┗━━━┓//┃┣┓//┃┏┛//┗┓┓┏━┳┓┏┛//┃┫┫┃┫┫//┗┻┛┗┻┛
Daily Diligence
Android Java.lang.IllegalArgumentException:pointerIndex out of range