0

我注意到在关闭 AndEngine 的 SimpleBaseGame 活动后,所有常见的活动都运行得很慢,如果我再次启动 AndEngine 活动,它的运行速度也很慢。好像还有一些数据留在内存中。我试着用这个:

@Override
protected void onStop() {
    super.onStop();
    unloadTextures();
    finish();
}

protected void unloadTextures() {
    for (IEntity entity : objects) {
        if (entity != null) {
            entity.detachSelf();
        }
    }
    for (ITexture atlas : atlases) {
        textureManager.unloadTexture(atlas);
    }
}

但这无济于事。请告诉我如何正确卸载资源?我找到了 GLES1 的解决方案,但在这里不起作用。

4

1 回答 1

2

Ok, that was my mistake. Seems that once launched Thread keeps running even if object is destroyed. When I stop it manually, everything is ok. If code above wouldn't enough, look here: http://www.andengine.org/forums/post39655.html#p39655

于 2012-09-18T08:29:18.243 回答