tags:

views:

17

answers:

1

I have a mediaplayer object inside an activity that plays from mp3 files situated in the res/raw folder. The

MediaPlayer.create(Context context, int resid)

method is used to create and return a mediaPlayer object to play this track.

What I have noticed is that when the activity is obscured by another activity and hence the "onStop()" method is called , the music continues to play. Can anyone explain why this occurs? I though that onStop would essentially freeze any actions taking place by objects associated with the activity, except for services etc

A: 

Media player runs on a separate thread and therefore the finishing of an actvity does not affect it.

you'll have to stop the mediaplayer by using the its stop method.

be sure to use the release method to free the acquired resources.

Umesh
Ah thanks. Yes I have been stopping and releasing.
x1886x