Blank black screen while shifting between activities android

回眸只為那壹抹淺笑 提交于 2019-12-11 16:16:59

问题


Hi Guys I have 2 activities, 1 is in Android Native(Extends Activity) and 2 is in LIBGdx extends AndroidApplication.

I go from activity 1 to activity 2 and then come back to activity 1 by pressing the back key, then I come back to activity 2 again. This time activity 2 is black and black in color.

Does it has anything to do with libgdx or its an android issue?

Thanks


回答1:


This sounds like libGdx is losing the openGL context. libgdx will get this back automatically when the app goes out of focus (incoming phone call, user presses home key, etc) and then comes back into focus, but here the app never loses focus--only the activity does--so libgdx doesn't know to restore itself.

Does the user need to go back to the first screen? If not, I would mark the first activity android:noHistory="true" in the manifest. That makes the back button skip the activity, so the app itself will lose focus.

Otherwise, put debug statements in your ApplicationListener's create(), resume(), pause(), and dispose() methods so we can see how that life cycle is playing out.



来源:https://stackoverflow.com/questions/26009621/blank-black-screen-while-shifting-between-activities-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!