1

Hi I need to stop sound from mediaplayer on screen Lock As I am using

if(mp!= null && mp.isPlaying()){
    mp.stop();
  }

in onPause() . But there is no result. So, How can I stop my media player sound after screen is locked.

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 & when the screen is locked , Again same is repeating on my Android 2.3.6 version mobile. How to overcome this.

Thank you.

4

3 に答える 3

1

Screen On & Off インテントを介して処理する必要があります。

詳細については、以下のリンクを参照してください:
http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

于 2013-05-07T13:22:30.957 に答える