title: Android MediaPlayer Question
body: <pre><code>public class PlayAudio extends BroadcastReceiver{
         private Context mContext;
          MediaPlayer mp;
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      mContext = context;
      mIntent = intent;
      playSound("sound.mp3");
  
      }
  
         private void playSound(String file){
             mp = MediaPlayer.create(mContext, Uri.parse("file://"+file));
             if (mp.isPlaying())
             {
                mp.stop();
             }
  
                  mp.setLooping(true);
                  try {
                     mp.prepare();
              } catch (IllegalStateException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
                  mp.start();
          }
  
  }
  </code></pre>
  
  <p>I am getting an error when i check if mp is playing. How can i check if MediaPlayer(mp) is playing so that i can stop it?</p>