title: How to stop sound after Screen Lock
body: <p>Hi I need to stop sound from mediaplayer on screen Lock As I am using</p>
  
  <pre><code>if(mp!= null &amp;&amp; mp.isPlaying()){
      mp.stop();
    }
  </code></pre>
  
  <p>in onPause()  . But there is no result. So, How can I stop my media player sound after screen is locked.</p>
  
  <p>To say exactly, I have 16 mp3 files, which will come in random.if a sound is playing and the screen is locked, present sound is Stopped and next one sound is playing.After screen is unlocked, it will works as proper &amp; when the screen is locked , Again same is repeating on my Android 2.3.6 version mobile. How to overcome this. </p>
  
  <p>Thank you.</p>