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