Log in or register to post comments

Switching between QCAR- and other Activities

November 10, 2011 - 12:49am #1

Hello,

we use ImageTargets as a base for a simple test application. Depending on the detected marker, the app should either display a 3D object or play a video file via the MediaPlayer class. This works pretty good, but as soon as we finish to the MediaPlayer activity (by pressing the back button), the app re-initializes (showing the splash screen and reloading all our OpenGL stuff). We want to prevent this, because it takes quite a while (10 to 15 seconds) since the app basically starts all over and reprocesses our 3D models. But we can't really figure out why this happens. We first thought that the MediaPlayer destroys our OpenGL context, but this doesn't seem to be the case, since even if we just start a very basic activity that displays a Toast, the app reloads. If we send the app in the background and reopen it, it doesn't need to reload and is instantly in tracking mode again. Any hints on what could be wrong?

Thanks.

Re: Switching between QCAR- and other Activities

November 11, 2011 - 1:10am #3
ksiva wrote:

Hmm, that's strange, I don't think that should be the case. Is onCreate being called again for the QCAR activity? Typically when you press the back button to jump back to the last activity you'll start with onResume.

Yes, onCreate is called again, which is a bit strange:

11-11 10:09:13.260: D/de.company.abc.app.MediaActivity(3067): back button pressed
11-11 10:09:13.470: D/QCAR(3067): App::onCreate
11-11 10:09:13.480: D/QCAR(3067): App::onResume
Quote:

Have you set the Android noHistory flag to true for any of the activities in the manifest? That would cause the QCAR activity to be destroyed when the next activity starts.

It wasn't set, but I put it explicitly to false now, just to be sure.

Quote:

Try again by adding a simple activity (that does nothing) to the ImageTargets sample, and jump to it when a marker is detected. This seems to work for me.

I tried just displaying a simple Toast in a new activity, doesn't work either.

Re: Switching between QCAR- and other Activities

November 10, 2011 - 7:55pm #2

Hmm, that's strange, I don't think that should be the case. Is onCreate being called again for the QCAR activity? Typically when you press the back button to jump back to the last activity you'll start with onResume.

Have you set the Android noHistory flag to true for any of the activities in the manifest? That would cause the QCAR activity to be destroyed when the next activity starts.

Try again by adding a simple activity (that does nothing) to the ImageTargets sample, and jump to it when a marker is detected. This seems to work for me.

- Kim

Log in or register to post comments