0

i have received a mail from Google play regarding a crash in my app. the stack trash as follow

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)

how i found and fix this because i have tested it thoroughly but not found this type of error. any suggestion how to find that error.

here is my code for wheel scrolling

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();

        }
    });
4

1 回答 1

0

您的数组中没有元素onScrollingFinished

放置一个 try catch 语句或检查是否wheelview.getCurrentItem()NULL

你是如何初始化你的数组的?你在哪里初始化它?你应该避免gc() 更多地调用它

于 2013-08-06T07:11:41.023 回答