0

我在我的动画应用程序中使用andengine。当我使用精灵点击事件时,它会出现奇怪的问题。我正在使用这个精灵来隐藏在 android 原生布局中显示视图。

我的 logcat 输出

        04-01 18:21:43.966: E/AndroidRuntime(1875): FATAL EXCEPTION: GLThread 3832
        04-01 18:21:43.966: E/AndroidRuntime(1875): java.lang.IndexOutOfBoundsException: Invalid index 42, size is 42
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at java.util.ArrayList.get(ArrayList.java:304)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.entity.Entity.onManagedDraw(Entity.java:1382)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.entity.scene.Scene.onManagedDraw(Scene.java:260)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.entity.Entity.onDraw(Entity.java:1160)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.engine.Engine.onDrawScene(Engine.java:627)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.engine.Engine.onDrawFrame(Engine.java:617)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at org.andengine.opengl.view.EngineRenderer.onDrawFrame(EngineRenderer.java:105)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
        04-01 18:21:43.966: E/AndroidRuntime(1875):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

我不知道为什么会导致请帮忙

编辑:

 04-01 18:53:01.420: D/AndEngine(2899): FirstBaseActivity.onDestroy @(Thread: 'main')
        04-01 18:53:01.420: D/AndEngine(2899): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
        04-01 18:53:01.420: D/AndEngine(2899): org.andengine.engine.Engine$EngineDestroyedException
        04-01 18:53:01.420: D/AndEngine(2899):  at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:574)
        04-01 18:53:01.420: D/AndEngine(2899):  at org.andengine.engine.Engine.onTickUpdate(Engine.java:560)
        04-01 18:53:01.420: D/AndEngine(2899):  at org.andengine.engine.Engine$UpdateThread.run(Engine.java:820)
        04-01 18:53:01.427: D/AndEngine(2899): FirstBaseActivity.onDestroyResources @(Thread: 'main')
        04-01 18:53:01.427: D/AndEngine(2899): FirstBaseActivity.onGameDestroyed @(Thread: 'main')

完整的日志猫

4

1 回答 1

1

问题是您正在从不同于UpdateThread. 也许来自一些触摸/传感器事件。如果你这样做,你必须派发到UpdateThreadvia runOnUpdateThread(Runnable)

于 2013-04-02T22:50:12.397 回答