>From the requirements that you mentioned, it seems to me that you need to
handle the onPause() ... (for the case when ur app is swapped out or another
app is on the screen), onResume(), onStop() and use the
OrientationEventListener (onOrientationChanged)
For the music player though, it might make sense to have a service.


On Tue, Feb 2, 2010 at 2:15 PM, Rico <[email protected]> wrote:

> I have a question about working with the activity lifecycle in
> Android.
>
> Let's suppose my app has some music playing.
>
> I want the music to continue playing in the following scenarios:
> - User changes screen orientation
> - User browses different activities within my app
>
> I want the music to stop playing in the following scenarios:
> - User presses home button
> - Another app comes to the foreground (e.g. Google talk message comes
> in and user chooses to reply, or user presses call-button to launch
> dialer app, or user presses camera button to launch camera app, etc.)
>
> What's the cleanest way to accomplish this?
>
> Thanks for reading and any help you can offer.
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Great spirits have always found violent opposition from mediocrities. The
latter cannot understand it when a man does not thoughtlessly submit to
hereditary prejudices but honestly and courageously uses his intelligence.
... Albert Einstein.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Aniruddh Bajirao
www.ryze.com/Aniruddh

-- 
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