title: Keeping MediaController on the screen in a VideoView
body: <p>I have trouble finding a way to keep the MediaController on the screen when using it with a VideoView. I want to play an Audio file which is located in res/raw in my app. The file is playing but I would like to keep the controller on the screen for the user to see the length of the file and how much time is left before the end etc. I found many time on forums that we should use the method .show(time) in order to do that, but I cannot figure out how to make it work.</p>
  
  <p>Here is the code I am using:
  </p>
  
  <pre class="lang-java prettyprint-override"><code>package com.sample.VideoViewExample;
  import android.app.Activity;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.SurfaceHolder;
  import android.widget.MediaController;
  import android.widget.VideoView;
  
  public class VideoViewExample extends Activity implements SurfaceHolder.Callback{
     private VideoView mVideoView;
     private MediaController mMedia;
  
     @Override
     public void onCreate(Bundle icicle) {
       super.onCreate(icicle);
       setContentView(R.layout.main);
  
       mVideoView = (VideoView) findViewById(R.id.surface_view);
       //mVideoView.getHolder().addCallback(this);
       //mMedia.show(50000);
       //mVideoView.setMediaController(mMedia);
  
       MediaController mMedia = new MediaController(this);
       mMedia.setMediaPlayer(mVideoView);
       mMedia.setAnchorView(mVideoView);
       mVideoView.setMediaController(mMedia);
  
       mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.osa_patient)); 
  
       mVideoView.requestFocus();
       mVideoView.start();
  
     }
  
  @Override
  public void surfaceChanged(SurfaceHolder holder, int format, int width,
          int height) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void surfaceCreated(SurfaceHolder holder) {
      // TODO Auto-generated method stub
      mMedia.show(500000);
  
  }
  
  @Override
  public void surfaceDestroyed(SurfaceHolder holder) {
      // TODO Auto-generated method stub
  
  }
  }
  </code></pre>
  
  <p>When I add the line mVideoView.getHolder().addCallback(this); the app bug, I am not sure why.</p>
  
  <p>Any help or alternative to what I would like to do is more than welcome :)</p>
  
  <p>Thanks,
  JB</p>