title: Detect when videoview stops playing
body: <p>I have this code for playing a video on a <code>VideoView</code></p>
  
  <pre><code>myVideoView = (VideoView) findViewById(R.id.VideoView);
  myVideoView.setVideoURI(Uri.parse(path));
  myVideoView.requestFocus();
  myVideoView.start();
  </code></pre>
  
  <p>When video is finish playing I get message :" Sorry, this video can't be played". I want to cache the moment when video is finish playing. How can I do this?</p>
  
  <p>Here is my code :</p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.video);
  
          Bundle extras = getIntent().getExtras();
          path = extras.getString("path");
          idPlaylist = extras.getString("idPlaylist");
          timer = extras.getString("timer");
  
          myVideoView = (VideoView) findViewById(R.id.VideoView);
          myVideoView.setVideoURI(Uri.parse(path));
          myVideoView.requestFocus();
          myVideoView.start();
  
          myVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
              public void onCompletion(MediaPlayer mp) {
                  Intent i = new Intent(getBaseContext(),
                          com.PlayerOrange.ViewPlaylist.class);
                  i.putExtra("id", idPlaylist);
                  i.putExtra("timer", timer);
                  startActivity(i);
                  finish();           
                  }
            });
  
      }
  
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          System.out.println("Playing "+myVideoView.isPlaying());
          if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; (myVideoView.isPlaying()==true)) {
                  //nothing happens
          } else {
              Intent i = new Intent(getBaseContext(),
                      com.PlayerOrange.ViewPlaylist.class);
              i.putExtra("id", idPlaylist);
              i.putExtra("timer", timer);
              startActivity(i);
              finish();
              return true;
          }
  
          return super.onKeyDown(keyCode, event);
      }
  </code></pre>