I use SurfaceView and handle all the threading myself. From reading some of the docs in the Nvidia SDK, which are very good, I see that you should be able to retain your OGL context even if your surface gets destroyed. I'm not sure if GLSurfaceView handles it this way but IIRC some people weren't using GLSurfaceView for just that reason.

On 10/11/2011 5:54 AM, redfalcon2k wrote:
We have an Augmented Reality app that displays either a video or a 3D
model when pointing on a specific marker. This works fine, but as soon
as we quit the MediaPlayer activity via the Back-Button, the OpenGL
Context seems to get destroyed. The app then just restarts and needs
to reload all assets including the 3D model which causes a delay of
about 10-15 seconds which we want to prevent. I read already something
about setPreserveEGLContextOnPause(true) and put it in our
GLSurfaceView (we have a 3.x tablet), but it doesn't seem to do
anything (do I need to implement something else to make it work? I
barely found usable documentation about it). We also call the
SurfaceView's onPause and onResume methods in the respective main
activity methods.

I'm not sure where in our app the problem could be, I suppose that
somewhere our GLSurface gets destroyed and we dont notice it.

Our code from exiting from the MediaPlayer is this:
public boolean onKeyDown(int keyCode, KeyEvent event) {
     if ((keyCode == KeyEvent.KEYCODE_BACK)) {
         this.finish();

         Intent intent = new Intent(MediaPlayerActivity.this,
OpenGLActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         this.startActivity(intent);
     }
     return super.onKeyDown(keyCode, event);
}


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to