Very useful thread, thanks a lot!

I'm using a similar solution like yours, the difference is that my
"finish();" is located in onStop. So it is only finished when it can
not be seen from the user, I feel this is a little bit better than
onPause.

they say
"Prior to 2.0 multiple surfaces on top of each other were not
supported, and
any tricks you use to try to make this work are likely to break in the
future or on different devices."

This is exactly what I'm worrying about...

On Dec 17, 3:17 am, Ethan Rublee <[email protected]> wrote:
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> Same issue, I resolved it by calling finish() when the onPause()
> function gets called (ie when home is pressed). This totally stops the
> activity, and then next time it starts, it starts fresh, with opengl
> surface first, then camera preview surface.  I also block the search
> button.
>
> I noticed in Layar, when you hit the search button, and then back out
> of search, the opengl disappears.  We aren't alone :)  You can see my
> app on
> youtubehttp://www.youtube.com/watch?v=PbbZzLkz4gc
>
> Hope this helps.
>
> On Dec 16, 8:30 am, mianwo <[email protected]> wrote:
>
> > I have a SurfaceView and a GLSurfaceView inside a FrameLayout.
> > The first SurfaceView is used for camera preview, and the
> > GlSurfaceView is for drawing 3D objects that are supposed to be on top
> > of the camera preview.
> > So natually, I compose the xml like this:
>
> > <FrameLayout
> >         android:layout_width="fill_parent"
> >         android:layout_height="fill_parent"
> >         android:id="@+id/mainFrame">
> >         <SurfaceView android:id="@+id/camSurface"
> >                 android:layout_width="fill_parent"
> >                 android:layout_height="fill_parent"/>
> >         <android.opengl.GLSurfaceView android:id="@+id/glSurface"
> >                 android:layout_width="fill_parent"
> >                 android:layout_height="fill_parent"/>
> > ... ...
>
> > Unfortunetly, this doesn't work. 3D objects can not be seen.
> > I found later that it only works when the order of the 2 views is
> > reversed, which means:
>
> > <android.opengl.GLSurfaceView android:id="@+id/glSurface"...
> > <SurfaceView android:id="@+id/camSurface"...
>
> > The reversed ui works fine, for a while...
> > Everything is OK when the app has a fresh start. But when I press home
> > to go back to the desktop and then click on the icon again to resume
> > the app, 3D objects are gone.
> > Then I reverse the ui again, like before, no 3D objects. But when I
> > press home and then resume the app, they appeared!
>
> > My conclusions are:
> > The order of the 2 surface view are wrong in the fresh start, but when
> > the app is resumed from another task, they are set back to their
> > normal order.
>
> > Is this a bug? Anyone experience the same problem?
>
> > I'm running CM 4.2.5 rom with 1.6 firmware on a HTC G2.

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