title: Cannot resolve symbol MediaPlayer.setOnCompletionListener
body: <p>I am a beginner, just started android. I am trying to do something on my sound completion. So i have called a setOnCompletionListener by MediaPlayer object. But error occurs saying cannot resolve symbol setOnCompletionListener.
  Please do help me to sort out this problem.</p>
  
  <p><strong>Here, is Code Package</strong></p>
  
  <pre><code>package com.example.jay_mainframe.justjava;
  
  import android.media.MediaPlayer;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  
  public class MainActivity extends AppCompatActivity  {
      MediaPlayer mp;
      Button btn;
      boolean flag=true;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mp = MediaPlayer.create(this, R.raw.birthday);
          btn=(Button)findViewById(R.id.play_btn);
  
      }
  
      public void playMusic(View view){
          if (flag) {
              mp.start();
              btn.setText("Pause Me");
              flag=false;
          }
          else {
              mp.pause();
              btn.setText("Play me");
              flag = true;
          }
  
      }
  
      mp.setOnCompletionListener(new OnCompletionListener() {
          @Override
          public void onCompletion(MediaPlayer mp) {
              //Do the work after completion of audio
          }
      });
  
  }
  </code></pre>
  
  <p>`</p>