IllegalArgumentException: pointerIndex out of rang

解决java.lang.IllegalArgumentException: pointerIndex out of range的错误          

 

在网上很多关于该bug的处理都众说纷纭,我在这里不再详述该bug产生的原因,下面给出一种在4.1的机子上测试通过的方案:

1.让你的view(可能是ScrollView,WebView,MapView等),创建一个子view继承于它们中的某一个;

2.重写onInterceptTouchEvent 和onTouchEvent方法

3.try catch 该两个方法,形如下面:

try{

super.onInterceptTouchEvent(MotionEvent ev)

} catch(ILLegalArgumentException ex) {

}

return false;

try{

super.onTouchEvent(MotionEvent ev)

} catch(ILLegalArgumentException ex) {

}

return false;


你可能感兴趣的:(IllegalArgumentException: pointerIndex out of rang)