title: Android 9 - Trouble orchestrating multiple stacked VideoView objects SM-G950U
body: <p>I've been struggling to get a common viewing area on the display to be shared by multiple video streams.
  The streams are selected by touching on a thumbnail of the stream contained in a layout below the main viewing area containing a matrix of all the thumbnails.
  The streams are being managed by GStreamer and from the screenshot, you can see the streams are flowing.</p>
  
  <p><a href="https://i.stack.imgur.com/snkqZ.jpg" rel="nofollow noreferrer">Screenshot</a></p>
  
  <p>The left thumbnail at the bottom of the screenshot is displayed in the main viewing area when the app starts.</p>
  
  <p>The desired behavior is when the OnClickListener fires when touching the thumbnail on the right, the current VideoView object should go in the background and the new VideoView object in reference to the onClick event should come into the foreground, on top of the previous one.</p>
  
  <p>I've tried combinations of sharing the main VideoView object and trying to swap the underlying Surface object, as well as removing the old VideoView object from the main viewer layout and adding the new selected VideoView object to the main layout.</p>
  
  <p>Currently, I have a VideoView object for each thumbnail stream and a VideoView object for the main viewer stream (via a tee element in the GStreamer pipeline).  I'm trying combinations of 
  setVisibility(View.INVISIBLE) and setVisibility(View.VISIBLE) as well as setZOrderMediaOverlay(true), setZOrderMediaOverlay(false) and setZOrderOnTop(true), setZOrderOnTop(false).</p>
  
  <p>If I do setVisibility(View.INVISIBLE), the surface in the VideoView object is destroyed, but the new selected object is displayed.  the setZOrder* methods alone don't seem to have a desired effect.</p>
  
  <p>Is there a way to hide a VideoView &amp; its surface without the surface getting destroyed while another VideoView is executing visually on top?  Is that the recommended way?</p>
  
  <p>It's hard to tell from the posts I've been scouring to solve the problem.</p>
  
  <p>Thanks for any feedback.
  - Doug</p>