gpt4 book ai didi

java - 将 Android 布局与 LayoutBaseGameActivity 一起使用时,Andengine 上出现奇怪的问题?

转载 作者:行者123 更新时间:2023-12-01 14:43:06 26 4
gpt4 key购买 nike

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

我的 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')

完整的日志

最佳答案

问题是您正在从不同于 UpdateThread 的线程修改场景图。也许来自一些触摸/传感器事件。如果这样做,您必须通过 runOnUpdateThread(Runnable) 分派(dispatch)到 UpdateThread

关于java - 将 Android 布局与 LayoutBaseGameActivity 一起使用时,Andengine 上出现奇怪的问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15743929/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com