Log in or register to post comments

Returning to Camera - Black screen

March 24, 2012 - 9:00pm #1

I’m writing a program that gives the option for the user to return to the main menu. I do setContentView to get back to the main menu view, but when trying to start the camera/AR view again from the menu, the camera preview shows up as black. The button callback function to do this basically calls updateApplicationStatus (APPSTATUS_INIT_APP)

The 3D renderings (glView) are visible if the camera points to the marker, but no camera preview is displayed.

Moreover, if I quit the app and launch it again (onResume), the camera background shows up fine. Any ideas why this is happening?

Thanks you!

Returning to Camera - Black screen

May 14, 2015 - 9:13am #3

This really helped me, but now onResume I get a single still frame.  It's a fresh frame every time I perform resume, so the camera is working, but apparently not very zealously.  Any thoughts?

I've got all methods controlled from overridden onPause/onResume functions in my GLSurfaceView:

    public void onPause() {

    public void onResume() {


Re: Returning to Camera - Black screen

March 25, 2012 - 6:43pm #2

So it sounds like you're trying to create a menu without switching activities, is that right? I don't think you should reinitialize everything in this case (which is what happens when you jump to APPSTATUS_INIT_APP). Instead, I suggest doing everything that the samples do in onPause and onResume. So when you want to show your menu, you'll pause the glView, stop the camera, and pause QCAR. Then do the opposite when you want to resume the AR view.

Also, I don't suggest setting the content view back to your menu. Instead, add the menu as an additional content view (over the glView) and toggle its visibility.

It might be simplest to use multiple activities and switch between them.

- Kim

Log in or register to post comments