0
내 앱에서 충돌과 관련하여 Google Play에서 메일을 받았습니다. 로 스택 쓰레기 내가 어떻게 찾았는지Google Play의 오류 보고서
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
at java.util.ArrayList.get(ArrayList.java:304)
at com.mycompanyname.myappname.Main$2.onScrollingFinished(Main.java:161)
at android.wheel.widget.WheelView.notifyScrollingListenersAboutEnd(WheelView.java:295)
at android.wheel.widget.WheelView$1.onFinished(WheelView.java:156)
at android.wheel.widget.WheelScroller.finishScrolling(WheelScroller.java:248)
at android.wheel.widget.WheelScroller$2.handleMessage(WheelScroller.java:220)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
따라 내가 그것을 철저하지만 이러한 유형의 오류를 발견 테스트 때문에이 문제를 해결. 어떤 제안이라도 그 오류를 찾는 방법. wheelview.getCurrentItem()
가 어떻게 초기화하는 NULL
여부
경우 여기
는 시도 캐치 문을 넣어 또는 확인onScrollingFinished
에 대한 여러분의 배열에 요소가없는
public void onScrollingFinished(WheelView wheel) {
WheelScrolled = false;
System.gc();
ivImage.setImageResource(images[wheelview.getCurrentItem()]);
tvName.setText(names[wheelview.getCurrentItem()]);
tvText.setText(_dataList.get(wheelview.getCurrentItem()).data);
System.gc();
}
});
코드를 게시하십시오. 배열에 onScrollingFinished에 아무 요소도 없습니다 – Tarun
@Tarun 데이터를 설정하는 데 arraylist를 사용하고있는 곳에서 코드를 게시했습니다 –
catch 문을 사용하거나'cwheelview.getCurrentItem()'이 NULL인지 확인하십시오. – Tarun