[android-developers] TabActivity and GLSurfaceView

2010-07-27 Thread Alimae
Hi,

In my app, i have a TabActivity with 2 tabs.
-Tab1 displays a web page (with WebViewClient)
-Tab2 displays contains a FrameLayout with 2 SurfaceViews :

The first SurfaceView contains the videocapture from the camera.
The second surfaceview is a GLSurfaceView.

The app works fine. I can switch from a tab to another.

But i want optimise my app :
When i switch from Tab2 to Tab1, i want to pause my render.
So in the Tab2 activity i reimplement

 @Override
public void onPause() {
Log.i(LOGTAG, onPause);
super.onPause();
myGLSurfaceView.onPause();

}
@Override
public void onResume(){
Log.i(LOGTAG, onResume);
super.onResume();
myGLSurfaceView.onResume();
}


With this code, my render is stopped, but when i reswitch in the Tab2,
the GLSurfaceView is recreated (onSurfaceCreated(GL10 gl, EGLConfig
config) is called). The surface is re-created but i have never seen a
surfaceDestroyed call.

What's wrong?

-- 
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] GLSurfaceView onPause/onResume

2010-07-09 Thread Alimae
Hi,

I have an app wich is is a TabActivity with 3 tabs.
Each tab is an activity.

The first tab (Activity1) has a FrameLayout which contains a
GLSurfaceView. All the GL code is done in my native library (using the
ndk)/
I have put logs into the onSurfaceDestroyed (in GLSurfaceView) and the
onSurfaceCreated (in the renderer of the GLSurfaceView) methods to
know when they are called

I launch the app, the first tab (Activity1) is displayed, my GL stuff
works fine.
I switch to the second tab, Activity1 receives the onPause event, so i
call the GLSurfaceView.onPause to pause the glThread. That's works.

I 'm in the second tab, i re-switch in the first tab. Activity1
receives the onResume event, so i call the GLSurfaceView.onResume but
i see in my logs that onSurfaceCreated is called  and i have never
seen onSurfaceDestroyed in logs ...

If I don't call the GLSurfaceView.onPause/onResume, the switch/re-
switch works but onDrawFrame is always called.
Of course, i can use a boolean to draw nothing when the activity is
paused but the onDrawFrame is always called and official doc
recommends to call the GLSurfaceView.onPause/onResume methods.

Any ideas about that?

-- 
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