I have an Android app which is based on OpenGL ES 2.0.

Everything works fine, I have a splashscreen which is displayed while an AsyncTask loads my resources in the background. My GLRenderer is set up and once everything is loaded, the splashscreen is dismissed.

However if you do the following, then within onWindowFocusChanged(boolean hasFocus), hasFocus is 'true' even though the app is not visible to the user.

  • Launch app
  • Press 'Home' key to send app to background.
  • Everything continues to load in the background as expected
  • Once everything has loaded and splashscreen is dismissed onWindoFocusChanged is called even though the app isn't visible

Is there any way to explain this behaviour or stop it happening? As mentioned above, if you simply allow the app to load while it's on the sceen, once the GLSurfaceView is displayed, you can pretty much do anything and it will behave correctly. Weird.

Test Device: Google Nexus 10

Android OS Version: Lollipop 5.0.1

Related posts

Recent Viewed