[android-developers] Re: Black screen after switching to another app
MobileVisuals astralvisuals.com> writes: > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > forth between these. The SurfaceView is the application GUI. > > I test switching to another app. I can then switch back to the > GLSurfaceView in my app. I then try to switch back to the > GLSurfaceView,where the application GUI is. Here is where the problem > occurs. A black screen is shown instead of the GUI. > > The app still works, because the application menu is shown when the > menu button is pressed. But nothing is drawn on the screen, it is only > black. I have tried almost everything to fix this, I have checked that > the thread is running and that no instance of any object (like the > SurfaceHolder) is null. What could be the reason for this black screen? > I had the same problem with my app. The problem is that you lose the GL context if your application goes to the background, and so you lose all bound textures (if you're using texture mapping), and you also lose the viewport. You need to reload all your textures and you need to re-set your viewport and projection matrix, etc. You should do this on your activities onResume() method, but you won't have a GL context there, so just set a flag in your renderer to tell it to reload everything. Your renderer will NOT always get an onSurfaceChanged() call after the resume, so don't rely on that to reset your viewport! Because you can't rely on onSurfaceChanged(), you also need to use saved values to set viewport width and height. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
Do you mean connecting to a special type of XML test page or just a standard web page? On Sep 12, 9:34 am, MobileVisuals wrote: > Do you mean just switching the app to the web browser, connect to a > web page and then switching back to the app, when GLSurfaceview is not > implemented? Or do you mean connecting to a special type of XML test > page? > > On Sep 9, 6:10 am, dusty wrote: > > > have it go to an xml test page before you test it with the > > GLSurfaceView. This is what i do to test the application and then > > when everything is changing between the pages then implement your > > GLSurfaceView. > > > On Sep 8, 8:03 am, MobileVisuals wrote: > > > > Does anyone know what I can try to do to fix this issue? > > > > On Sep 7, 2:07 pm, MobileVisuals wrote:> I > > > have already debugged the code lots of times with breakpoints, but I > > > > can not find the cause for the black screen. The thread runs like it > > > > should and no instances are null. > > > > > On Sep 7, 10:30 am, MarcoAndroid wrote: > > > > > > Are you sure you know which code gets executed? I'd add breakpoints/ > > > > > logging statements to see what's happening... At least a logstatement > > > > > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > > > > > you get a better idea on what's going on. > > > > > > On 6 sep, 18:58, MobileVisuals wrote: > > > > > > > Thanks, I added this code to the app, but the problem remains. I > > > > > > don't > > > > > > know if I should use suspend and resume on the GUI thread, because > > > > > > the > > > > > > documentation says that it could cause deadlocks.Do you know if > > > > > > there > > > > > > is some more that I can do to solve this issue? > > > > > > > protected void onPause() { > > > > > > > super.onPause(); > > > > > > > if (!menu2d) > > > > > > glSurfaceView.onPause(); > > > > > > else > > > > > > mLunarView.getThread().suspend(); > > > > > > > } > > > > > > protected void onResume() { > > > > > > super.onResume(); > > > > > > if (!menu2d) > > > > > > glSurfaceView.onResume(); > > > > > > else > > > > > > mLunarView.getThread().resume(); > > > > > > > } > > > > > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > > > > > wrote: > > > > > > > > On 6 September 2011 13:32, MobileVisuals > > > > > > > wrote: > > > > > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch > > > > > > > > back and > > > > > > > > forth between these. The SurfaceView is the application GUI. > > > > > > > > > I test switching to another app. I can then switch back to the > > > > > > > > GLSurfaceView in my app. I then try to switch back to the > > > > > > > > GLSurfaceView,where the application GUI is. Here is where the > > > > > > > > problem > > > > > > > > occurs. A black screen is shown instead of the GUI. > > > > > > > > > The app still works, because the application menu is shown when > > > > > > > > the > > > > > > > > menu button is pressed. But nothing is drawn on the screen, it > > > > > > > > is only > > > > > > > > black. I have tried almost everything to fix this, I have > > > > > > > > checked that > > > > > > > > the thread is running and that no instance of any object (like > > > > > > > > the > > > > > > > > SurfaceHolder) is null. What could be the reason for this black > > > > > > > > screen? > > > > > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > > > > > By the same token you should be calling GLSurfaceView.pause() in > > > > > > > the > > > > > > > right moment of your activity lifecycle. > > > > > > > > HTH > > > > > > > > -- > > > > > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
Do you mean just switching the app to the web browser, connect to a web page and then switching back to the app, when GLSurfaceview is not implemented? Or do you mean connecting to a special type of XML test page? On Sep 9, 6:10 am, dusty wrote: > have it go to an xml test page before you test it with the > GLSurfaceView. This is what i do to test the application and then > when everything is changing between the pages then implement your > GLSurfaceView. > > On Sep 8, 8:03 am, MobileVisuals wrote: > > > Does anyone know what I can try to do to fix this issue? > > > On Sep 7, 2:07 pm, MobileVisuals wrote:> I have > > already debugged the code lots of times with breakpoints, but I > > > can not find the cause for the black screen. The thread runs like it > > > should and no instances are null. > > > > On Sep 7, 10:30 am, MarcoAndroid wrote: > > > > > Are you sure you know which code gets executed? I'd add breakpoints/ > > > > logging statements to see what's happening... At least a logstatement > > > > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > > > > you get a better idea on what's going on. > > > > > On 6 sep, 18:58, MobileVisuals wrote: > > > > > > Thanks, I added this code to the app, but the problem remains. I don't > > > > > know if I should use suspend and resume on the GUI thread, because the > > > > > documentation says that it could cause deadlocks.Do you know if there > > > > > is some more that I can do to solve this issue? > > > > > > protected void onPause() { > > > > > > super.onPause(); > > > > > > if (!menu2d) > > > > > glSurfaceView.onPause(); > > > > > else > > > > > mLunarView.getThread().suspend(); > > > > > > } > > > > > protected void onResume() { > > > > > super.onResume(); > > > > > if (!menu2d) > > > > > glSurfaceView.onResume(); > > > > > else > > > > > mLunarView.getThread().resume(); > > > > > > } > > > > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > > > > wrote: > > > > > > > On 6 September 2011 13:32, MobileVisuals > > > > > > wrote: > > > > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back > > > > > > > and > > > > > > > forth between these. The SurfaceView is the application GUI. > > > > > > > > I test switching to another app. I can then switch back to the > > > > > > > GLSurfaceView in my app. I then try to switch back to the > > > > > > > GLSurfaceView,where the application GUI is. Here is where the > > > > > > > problem > > > > > > > occurs. A black screen is shown instead of the GUI. > > > > > > > > The app still works, because the application menu is shown when > > > > > > > the > > > > > > > menu button is pressed. But nothing is drawn on the screen, it is > > > > > > > only > > > > > > > black. I have tried almost everything to fix this, I have checked > > > > > > > that > > > > > > > the thread is running and that no instance of any object (like the > > > > > > > SurfaceHolder) is null. What could be the reason for this black > > > > > > > screen? > > > > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > > > > By the same token you should be calling GLSurfaceView.pause() in the > > > > > > right moment of your activity lifecycle. > > > > > > > HTH > > > > > > > -- > > > > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
have it go to an xml test page before you test it with the GLSurfaceView. This is what i do to test the application and then when everything is changing between the pages then implement your GLSurfaceView. On Sep 8, 8:03 am, MobileVisuals wrote: > Does anyone know what I can try to do to fix this issue? > > On Sep 7, 2:07 pm, MobileVisuals wrote:> I have > already debugged the code lots of times with breakpoints, but I > > can not find the cause for the black screen. The thread runs like it > > should and no instances are null. > > > On Sep 7, 10:30 am, MarcoAndroid wrote: > > > > Are you sure you know which code gets executed? I'd add breakpoints/ > > > logging statements to see what's happening... At least a logstatement > > > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > > > you get a better idea on what's going on. > > > > On 6 sep, 18:58, MobileVisuals wrote: > > > > > Thanks, I added this code to the app, but the problem remains. I don't > > > > know if I should use suspend and resume on the GUI thread, because the > > > > documentation says that it could cause deadlocks.Do you know if there > > > > is some more that I can do to solve this issue? > > > > > protected void onPause() { > > > > > super.onPause(); > > > > > if (!menu2d) > > > > glSurfaceView.onPause(); > > > > else > > > > mLunarView.getThread().suspend(); > > > > > } > > > > protected void onResume() { > > > > super.onResume(); > > > > if (!menu2d) > > > > glSurfaceView.onResume(); > > > > else > > > > mLunarView.getThread().resume(); > > > > > } > > > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > > > wrote: > > > > > > On 6 September 2011 13:32, MobileVisuals > > > > > wrote: > > > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > > > > > forth between these. The SurfaceView is the application GUI. > > > > > > > I test switching to another app. I can then switch back to the > > > > > > GLSurfaceView in my app. I then try to switch back to the > > > > > > GLSurfaceView,where the application GUI is. Here is where the > > > > > > problem > > > > > > occurs. A black screen is shown instead of the GUI. > > > > > > > The app still works, because the application menu is shown when the > > > > > > menu button is pressed. But nothing is drawn on the screen, it is > > > > > > only > > > > > > black. I have tried almost everything to fix this, I have checked > > > > > > that > > > > > > the thread is running and that no instance of any object (like the > > > > > > SurfaceHolder) is null. What could be the reason for this black > > > > > > screen? > > > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > > > By the same token you should be calling GLSurfaceView.pause() in the > > > > > right moment of your activity lifecycle. > > > > > > HTH > > > > > > -- > > > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
The thread runs like it should and no instances are null. Does anyone know what else could cause the black screen? On Sep 8, 3:03 pm, MobileVisuals wrote: > Does anyone know what I can try to do to fix this issue? > > On Sep 7, 2:07 pm, MobileVisuals wrote: > > > I have already debugged the code lots of times with breakpoints, but I > > can not find the cause for the black screen. The thread runs like it > > should and no instances are null. > > > On Sep 7, 10:30 am, MarcoAndroid wrote: > > > > Are you sure you know which code gets executed? I'd add breakpoints/ > > > logging statements to see what's happening... At least a logstatement > > > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > > > you get a better idea on what's going on. > > > > On 6 sep, 18:58, MobileVisuals wrote: > > > > > Thanks, I added this code to the app, but the problem remains. I don't > > > > know if I should use suspend and resume on the GUI thread, because the > > > > documentation says that it could cause deadlocks.Do you know if there > > > > is some more that I can do to solve this issue? > > > > > protected void onPause() { > > > > > super.onPause(); > > > > > if (!menu2d) > > > > glSurfaceView.onPause(); > > > > else > > > > mLunarView.getThread().suspend(); > > > > > } > > > > protected void onResume() { > > > > super.onResume(); > > > > if (!menu2d) > > > > glSurfaceView.onResume(); > > > > else > > > > mLunarView.getThread().resume(); > > > > > } > > > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > > > wrote: > > > > > > On 6 September 2011 13:32, MobileVisuals > > > > > wrote: > > > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > > > > > forth between these. The SurfaceView is the application GUI. > > > > > > > I test switching to another app. I can then switch back to the > > > > > > GLSurfaceView in my app. I then try to switch back to the > > > > > > GLSurfaceView,where the application GUI is. Here is where the > > > > > > problem > > > > > > occurs. A black screen is shown instead of the GUI. > > > > > > > The app still works, because the application menu is shown when the > > > > > > menu button is pressed. But nothing is drawn on the screen, it is > > > > > > only > > > > > > black. I have tried almost everything to fix this, I have checked > > > > > > that > > > > > > the thread is running and that no instance of any object (like the > > > > > > SurfaceHolder) is null. What could be the reason for this black > > > > > > screen? > > > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > > > By the same token you should be calling GLSurfaceView.pause() in the > > > > > right moment of your activity lifecycle. > > > > > > HTH > > > > > > -- > > > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
Does anyone know what I can try to do to fix this issue? On Sep 7, 2:07 pm, MobileVisuals wrote: > I have already debugged the code lots of times with breakpoints, but I > can not find the cause for the black screen. The thread runs like it > should and no instances are null. > > On Sep 7, 10:30 am, MarcoAndroid wrote: > > > Are you sure you know which code gets executed? I'd add breakpoints/ > > logging statements to see what's happening... At least a logstatement > > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > > you get a better idea on what's going on. > > > On 6 sep, 18:58, MobileVisuals wrote: > > > > Thanks, I added this code to the app, but the problem remains. I don't > > > know if I should use suspend and resume on the GUI thread, because the > > > documentation says that it could cause deadlocks.Do you know if there > > > is some more that I can do to solve this issue? > > > > protected void onPause() { > > > > super.onPause(); > > > > if (!menu2d) > > > glSurfaceView.onPause(); > > > else > > > mLunarView.getThread().suspend(); > > > > } > > > protected void onResume() { > > > super.onResume(); > > > if (!menu2d) > > > glSurfaceView.onResume(); > > > else > > > mLunarView.getThread().resume(); > > > > } > > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > > wrote: > > > > > On 6 September 2011 13:32, MobileVisuals > > > > wrote: > > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > > > > forth between these. The SurfaceView is the application GUI. > > > > > > I test switching to another app. I can then switch back to the > > > > > GLSurfaceView in my app. I then try to switch back to the > > > > > GLSurfaceView,where the application GUI is. Here is where the problem > > > > > occurs. A black screen is shown instead of the GUI. > > > > > > The app still works, because the application menu is shown when the > > > > > menu button is pressed. But nothing is drawn on the screen, it is only > > > > > black. I have tried almost everything to fix this, I have checked that > > > > > the thread is running and that no instance of any object (like the > > > > > SurfaceHolder) is null. What could be the reason for this black > > > > > screen? > > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > > By the same token you should be calling GLSurfaceView.pause() in the > > > > right moment of your activity lifecycle. > > > > > HTH > > > > > -- > > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
I have already debugged the code lots of times with breakpoints, but I can not find the cause for the black screen. The thread runs like it should and no instances are null. On Sep 7, 10:30 am, MarcoAndroid wrote: > Are you sure you know which code gets executed? I'd add breakpoints/ > logging statements to see what's happening... At least a logstatement > on all onStart(), onResume() onXYZ() methods entry points. Maybe then > you get a better idea on what's going on. > > On 6 sep, 18:58, MobileVisuals wrote: > > > Thanks, I added this code to the app, but the problem remains. I don't > > know if I should use suspend and resume on the GUI thread, because the > > documentation says that it could cause deadlocks.Do you know if there > > is some more that I can do to solve this issue? > > > protected void onPause() { > > > super.onPause(); > > > if (!menu2d) > > glSurfaceView.onPause(); > > else > > mLunarView.getThread().suspend(); > > > } > > protected void onResume() { > > super.onResume(); > > if (!menu2d) > > glSurfaceView.onResume(); > > else > > mLunarView.getThread().resume(); > > > } > > > On Sep 6, 2:43 pm, Daniel Drozdzewski > > wrote: > > > > On 6 September 2011 13:32, MobileVisuals wrote: > > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > > > forth between these. The SurfaceView is the application GUI. > > > > > I test switching to another app. I can then switch back to the > > > > GLSurfaceView in my app. I then try to switch back to the > > > > GLSurfaceView,where the application GUI is. Here is where the problem > > > > occurs. A black screen is shown instead of the GUI. > > > > > The app still works, because the application menu is shown when the > > > > menu button is pressed. But nothing is drawn on the screen, it is only > > > > black. I have tried almost everything to fix this, I have checked that > > > > the thread is running and that no instance of any object (like the > > > > SurfaceHolder) is null. What could be the reason for this black screen? > > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > > By the same token you should be calling GLSurfaceView.pause() in the > > > right moment of your activity lifecycle. > > > > HTH > > > > -- > > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
Are you sure you know which code gets executed? I'd add breakpoints/ logging statements to see what's happening... At least a logstatement on all onStart(), onResume() onXYZ() methods entry points. Maybe then you get a better idea on what's going on. On 6 sep, 18:58, MobileVisuals wrote: > Thanks, I added this code to the app, but the problem remains. I don't > know if I should use suspend and resume on the GUI thread, because the > documentation says that it could cause deadlocks.Do you know if there > is some more that I can do to solve this issue? > > protected void onPause() { > > super.onPause(); > > if (!menu2d) > glSurfaceView.onPause(); > else > mLunarView.getThread().suspend(); > > } > protected void onResume() { > super.onResume(); > if (!menu2d) > glSurfaceView.onResume(); > else > mLunarView.getThread().resume(); > > } > > On Sep 6, 2:43 pm, Daniel Drozdzewski > wrote: > > > > > > > > > On 6 September 2011 13:32, MobileVisuals wrote: > > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > > forth between these. The SurfaceView is the application GUI. > > > > I test switching to another app. I can then switch back to the > > > GLSurfaceView in my app. I then try to switch back to the > > > GLSurfaceView,where the application GUI is. Here is where the problem > > > occurs. A black screen is shown instead of the GUI. > > > > The app still works, because the application menu is shown when the > > > menu button is pressed. But nothing is drawn on the screen, it is only > > > black. I have tried almost everything to fix this, I have checked that > > > the thread is running and that no instance of any object (like the > > > SurfaceHolder) is null. What could be the reason for this black screen? > > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > > By the same token you should be calling GLSurfaceView.pause() in the > > right moment of your activity lifecycle. > > > HTH > > > -- > > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Black screen after switching to another app
Thanks, I added this code to the app, but the problem remains. I don't know if I should use suspend and resume on the GUI thread, because the documentation says that it could cause deadlocks.Do you know if there is some more that I can do to solve this issue? protected void onPause() { super.onPause(); if (!menu2d) glSurfaceView.onPause(); else mLunarView.getThread().suspend(); } protected void onResume() { super.onResume(); if (!menu2d) glSurfaceView.onResume(); else mLunarView.getThread().resume(); } On Sep 6, 2:43 pm, Daniel Drozdzewski wrote: > On 6 September 2011 13:32, MobileVisuals wrote: > > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > > forth between these. The SurfaceView is the application GUI. > > > I test switching to another app. I can then switch back to the > > GLSurfaceView in my app. I then try to switch back to the > > GLSurfaceView,where the application GUI is. Here is where the problem > > occurs. A black screen is shown instead of the GUI. > > > The app still works, because the application menu is shown when the > > menu button is pressed. But nothing is drawn on the screen, it is only > > black. I have tried almost everything to fix this, I have checked that > > the thread is running and that no instance of any object (like the > > SurfaceHolder) is null. What could be the reason for this black screen? > > Do you call GLSurfaceView.resume() from Activity.resume() ? > > By the same token you should be calling GLSurfaceView.pause() in the > right moment of your activity lifecycle. > > HTH > > -- > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en