2017-05-08 33 views
0

这个异常发生在activity的onstop中,没有自己的代码,所有的android框架代码。我不知道发生了什么!Activity onStop()==>无法停止活动{xxx}:java.lang.IndexOutOfBoundsException:索引:5,大小:5

java.lang.RuntimeException: Unable to stop activity {xxx}: java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4380) 
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4447) 
    at android.app.ActivityThread.-wrap6(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:173) 
    at android.app.ActivityThread.main(ActivityThread.java:6459) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) 
Caused by: java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 
    at java.util.ArrayList.get(ArrayList.java:411) 
    at android.view.WindowManagerGlobal.setStoppedState(WindowManagerGlobal.java:597) 
    at android.app.Activity.performStop(Activity.java:6842) 
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4375) 
    ... 9 more 
java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 
    at java.util.ArrayList.get(ArrayList.java:411) 
    at android.view.WindowManagerGlobal.setStoppedState(WindowManagerGlobal.java:597) 
    at android.app.Activity.performStop(Activity.java:6842) 
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4375) 
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4447) 
    at android.app.ActivityThread.-wrap6(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:173) 
    at android.app.ActivityThread.main(ActivityThread.java:6459) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) 
+2

邮政编码在哪里你曾经使用过数组 – Redman

+0

发布你的onstop代码 –

+0

你是[使用片段](http://stackoverflow.com/q/26041795/1270789)? –

回答

0

检查您的视频视图是否正在运行,然后尝试暂停它。

+0

中。所以我打电话给videoview.onpause暂停播放! – caiathou

+0

同意。但是你只是在检查那个特定视图的可空性。你还应该检查是否有东西被渲染。尝试使用if(mVideoView!= null && mVideoView .isRunning())。让我知道发生什么事。谢谢。没有使用“PLVideoTextureView”,所以isRunning部分可能会有所不同。 – Shashank

+0

我已添加此代码!经过一段时间,如果它是有用的,我会做 – caiathou

0

IndexOutOfBoundsException异常通常当假设您在ArrayList中只有一个元素出现,你正在试图让arraylist.elementatindex [1]这给IndexOutOfBoundsException异常,因为只有一个ArrayList中元素的。

+0

我知道。但是这个异常发生在它可能正在运行的android框架代码 – caiathou