Thanks for your reply, I'm looking into the documentation for Services now.

Tom

On 19/04/2010 19:31, Justin Anderson wrote:
First, whatever is playing the music should run as a service and not as an activity... I would probably create a NowPlayingService and a NowPlayingActivity.

Activities don't run in the background. When they are no longer visible they are paused by the OS. Services are allowed to run in the background and that is exactly how the built-in music player on Android works. It has a service in the background that actually plays the music.

You can find more about this here: http://developer.android.com/guide/topics/fundamentals.html#servlife

If you are already doing that then I'm not sure offhand what the problem is exactly. You may need to provide more details unless someone else has any idea...

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Mon, Apr 19, 2010 at 10:47 AM, Tom F M White <fred...@gmail.com <mailto:fred...@gmail.com>> wrote:

    Hi

    I'm making a simple media player app, that streams files from a site.
    Currently the fundamentals of my app work, it is downloading the track
    info, and playing the files fine. However, at the moment it isn't
    working in a user-friendly manner, and usually getting it to play more
    than one song is a big problem. Here is the basic structure:

    The main Activity is a ListActivity, on which the list of tracks
    on the
    site is displayed.
    Clicking these launches a Details Activity, which shows track info,
    artwork etc. and a play button.
    The play button launches the NowPlaying Activity, where the content is
    fetched and played.

    The idea is that once a track is playing, the user can continue to
    browse other tracks, and return to the NowPlaying Activity via the
    menu.
    At the moment, I can go back to the list, or to the Details
    Activity for
    the song that is playing, but loading up the Details Activity for
    another song causes the sound to stop, and then trying to play other
    songs doesn't work, they do not buffer or play.

    I'm pretty sure this is because rather than re-using the same
    Details/NowPlaying Activities to display different content, new
    ones are
    getting spawned but I'm not sure about this, or sure how I would
    overcome this. In particular it is important there is only one
    NowPlaying Activity, as this handles Notifications, and contains the
    MediaPlayer object, of which I only want one. I'm not really sure what
    to ask for, perhaps my explanation of the problem can help someone
    point
    out what I'm doing wrong.

    Thanks in advance

    Tom

-- You received this message because you are subscribed to the Google
    Groups "Android Beginners" group.

    NEW! Try asking and tagging your question on Stack Overflow at
    http://stackoverflow.com/questions/tagged/android

    To unsubscribe from this group, send email to
    android-beginners+unsubscr...@googlegroups.com
    <mailto:android-beginners%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/android-beginners?hl=en


--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to