This is probably a newbie question, but how can I pause and resume my media player in a service from my activity. Here is what I have set up so far, but it is not working.
pause.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
MyService.pauseSong();
}
});
In my service is this:
public void pauseSong(){
if (mediaPlayer.isPlaying() == true){
mediaPlayer.pause();
notificationManagerPlay.cancel(5);
pauseplay = 0;
}
}
Your help is appreciated so much!
Make a wrapper static singelton class for MediaPlayer and you can access it from anywhere.
For an example you can look here: Creating sound effects in android
As for singleton – Singleton wiki