按下Android后退按钮

时间:2012-03-06 21:05:15

标签: android listview

我的Android应用程序中有一个奇怪的问题。它是一个包含5个活动的应用程序,并且某些ListView存在问题。当您进入实现ListView的活动并向下滚动列表时,在列表滚动时按下后退按钮,应用程序崩溃。它是否与我实现onResume()函数有关,我错过了什么吗?

03-08 08:27:11.761: E/AndroidRuntime(19157): FATAL EXCEPTION: main
03-08 08:27:11.761: E/AndroidRuntime(19157): java.lang.IndexOutOfBoundsException: Invalid index 33, size is 0
03-08 08:27:11.761: E/AndroidRuntime(19157):    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at java.util.ArrayList.get(ArrayList.java:311)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at ro.service.project.ListAdapter2.getView(ListAdapter2.java:42)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.AbsListView.obtainView(AbsListView.java:1428)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.ListView.makeAndAddView(ListView.java:1793)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.ListView.fillDown(ListView.java:670)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.ListView.fillGap(ListView.java:641)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3452)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2950)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.os.Handler.handleCallback(Handler.java:587)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.os.Handler.dispatchMessage(Handler.java:92)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.os.Looper.loop(Looper.java:150)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at android.app.ActivityThread.main(ActivityThread.java:4293)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at java.lang.reflect.Method.invokeNative(Native Method)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at java.lang.reflect.Method.invoke(Method.java:507)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-08 08:27:11.761: E/AndroidRuntime(19157):    at dalvik.system.NativeStart.main(Native Method)
, and the onResume() function:
@Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        texta.clear();
    }

0 个答案:

没有答案