Thank you Mark....

Do you happen to know where I can find an example of MediaPlayer as a
Service? Did some searching but what I found didn't get me to where I
wanted to be. The examples I found had a single audio being played and
stopped via the service and I could not figure out how to add more
than one audio file.

-Marc

On Feb 16, 1:27 pm, Mark Murphy <[email protected]> wrote:
> MarcC wrote:
> > Can anyone tell me how to stop media player that was started in a
> > previous activity?
>
> You can't directly, AFAIK.
>
> > For ex. In activity-1 button pressed that did - mp.start(); then
> > activity-2 starts for different layout with new buttons, then when
> > button pressed, mp.stop is called, but does not stop the media from
> > the first activity.
>
> You would need the second activity to somehow notify the first activity
> to stop the playback. Ideally, you would just do all of this in one
> activity, or have the MediaPlayer be managed by a service, as
> activity<->activity communications on-the-fly strikes me as a more
> fragile pattern.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to