Cant Stop Playing Sound In Other Activity With Mediaplayer In Android
Solution 1:
Make all of your methods and class variables in SoundManager static (and pass in a Context for the methods that require one).
I would suspect that you are maybe creating a new instance of SoundManager in each of your Activities, which would create multiple instances of SoundManager. Making it statically accessible will mean all Activities are modifying the same variables.
Another note, I don't think you have to have an Activity Context, so try passing in your application's Context via context.getApplicationContext(). This will avoid tying the MediaPlayer object to any specific Activity.
Solution 2:
Just a guess as I don't know how you are sharing your Soundmanager object:
Maybe you create a new instance of your Soundmanager class in every Activity that is supposed to use it. (i.e. there is a new Soundmanager(context) in each of them or at least an additional one in the stopping Activity).
Post a Comment for "Cant Stop Playing Sound In Other Activity With Mediaplayer In Android"