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. (The framework made no guarantees about what order they would be placed in the window manager, it was just happenstance, and could change based on various conditions that may or may not have the same result in the future.)
As of 2.0, there is a hack you can use to at least control the Z-order of two surface views: http://developer.android.com/reference/android/view/SurfaceView.html#setZOrderMediaOverlay(boolean) On Sat, Dec 12, 2009 at 10:54 PM, Ethan Rublee <[email protected]>wrote: > Thanks, I realized this has been discussed at length else where. > > My solution has been to fully stop the activity on pause. It seemed > that > after a pause is when the camera surface would hide the opengl > surface. Completely restarting > the activity every time it pauses, by calling finish() in onPause(), > puts the surfaces in the intended order. > > This is not ideal, and feels like a hackish solution. Also, I have not > experimented on many phones, > so i do not know if this is a consistent solution. > > On Dec 7, 1:26 am, Romain Guy <[email protected]> wrote: > > There is no trick to using merge, there might however be an issue with > > overlaying two surfaceviews on top of each other. I'm pretty sure > > there's no guarantee of what the order of the underlying windows is > > going to be. > > > > > > > > On Sat, Dec 5, 2009 at 4:12 PM, Ethan Rublee <[email protected]> > wrote: > > > The following is the layout for my activity: > > > <merge android:layout_width="fill_parent" > > > android:layout_height="fill_parent" > > > xmlns:android="http://schemas.android.com/apk/res/android"> > > > > > <com.HiM.video.VideoOverlay > > > android:id="@+id/videooverlay" > > > android:layout_width="fill_parent" > > > android:layout_height="fill_parent"> > > > </com.HiM.video.VideoOverlay> > > > > > <com.HiM.video.VideoView > > > android:id="@+id/videoview" > > > android:layout_width="fill_parent" > > > android:layout_height="fill_parent"> > > > </com.HiM.video.VideoView> > > > > > </merge> > > > > > The idea is that it is overlaying an GLSurfaceView (VideoOverlay) over > > > a live preview from the camera (VideoView). it works fine except for > > > the following. > > > 1. I exit the app by pressing home button > > > 2. I reopen the app by holding home until recent apps appear, and then > > > i select my app > > > 3. Upon reopening the 3D box is hidden by the video preview. > > > 4. If i exit by using the back button, then everything is fine. > > > 5. if I switch the order of the views in the xml, then the opposite > > > behaviour occurs - back button hides the VideoOverlay behind the > > > VideoView, and home displays VideoOverlay ontop of the VideoView. > > > > >http://picasaweb.google.com/lh/photo/RGelzcQYpiy13DZFD3HB7g?feat=dire. > .. > > > is a picture of the desired behaviour. > > > > > Any suggestions welcome. I have a feeling there is some trick to > > > using merge. I am only using merge to enable me to have the views > > > completely overlay each other. If there is another way then I'm more > > > than willing to try it. > > > > > -- > > > 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]<android-developers%[email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > Romain Guy > > Android framework engineer > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time > > to provide private support. All such questions should be posted on > > public forums, where I and others can see and answer them > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

