Libgdx AndroidGraphics暂停标志永远不会设置为false

时间:2017-06-02 05:11:21

标签: android libgdx glsurfaceview

嗨,当AndroidGraphics暂停时,我遇到了问题。 假设我在滚动视图中有一个libgdx片段。当我在屏幕外滚动片段时,libgdx将停止渲染。然后我去另一个活动,将调用AndroidGraphics的pasue方法。在这个方法

while (pause) {
try {
// TODO: fix deadlock race condition with quick resume/pause.
// Temporary workaround:
// Android ANR time is 5 seconds, so wait up to 4 seconds before assuming
// deadlock and killing process. This can easily be triggered by opening the
// Recent Apps list and then double-tapping the Recent Apps button with
// ~500ms between taps.
synch.wait(4000);
if (pause) {
// pause will never go false if onDrawFrame is never called by the GLThread
// when entering this method, we MUST enforce continuous rendering
Gdx.app.error(LOG_TAG, "waiting for pause synchronization took too long; assuming deadlock and killing");
android.os.Process.killProcess(android.os.Process.myPid());
}
} catch (InterruptedException ignored) {
Gdx.app.log(LOG_TAG, "waiting for pause synchronization failed!");
}
}

等待暂停设置为false,但是libgdx surfaceview在屏幕之外并且onDrawFrame永远不会被调用所以

Gdx.app.error(LOG_TAG, "waiting for pause synchronization took too long; assuming deadlock and killing");
android.os.Process.killProcess(android.os.Process.myPid());

将被执行。这样我的应用程序崩溃了怎么解决这个问题?

0 个答案:

没有答案