title: Make videoview visible only when video is played
body: <p>i'm trying to display a videoview only when the video is played.
  When i click on an item of gridview the video starts and videoview is visible, but when the video stops, it doesn't desappear. Here the code:
  Main Activity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  public Integer[] mVideo = {
          R.raw.clesella, R.raw.simonino
  };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      GridView gridview = (GridView) findViewById(R.id.gridview);
      gridview.setAdapter(new VideoAdapter(this));
  
      gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              final VideoView mVideoView2 = (VideoView) findViewById(R.id.video);
              // VideoView mVideoView = new VideoView(this);
              String uriPath = "android.resource://"+ getPackageName()+"/"+mVideo[position];
              Uri uri2 = Uri.parse(uriPath);
              mVideoView2.setVideoURI(uri2);
              mVideoView2.requestFocus();
              mVideoView2.start();
              mVideoView2.postDelayed(new Runnable() {
                  public void run() {
  
                      mVideoView2.setVisibility(View.VISIBLE);
  
                  }
              }, mVideoView2.getDuration());
  
  
          }
  </code></pre>
  
  <p>Here the layout:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.graduation.nakama.harrygraduation.MainActivity"&gt;
  
  
  &lt;VideoView
      android:id="@+id/video"
      android:layout_width="wrap_content"
      android:layout_height="250dp"
      android:visibility="invisible"
      android:layout_alignParentStart="true"
      android:layout_marginTop="100dp" /&gt;
  
  &lt;GridView
      android:id="@+id/gridview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:columnWidth="90dp"
      android:numColumns="auto_fit"
  
      android:verticalSpacing="10dp"
      android:horizontalSpacing="10dp"
      android:stretchMode="columnWidth"
      android:gravity="center"
      android:layout_centerHorizontal="true" /&gt;
  </code></pre>
  
  <p></p>