On Apr 23, 12:43 pm, Thom Shutt <[email protected]> wrote: > I have a MediaPlayer playing music in a local Service andfor all other > pause/resumes, I pause/resume the MediaPlayer. I need the music to > carry on playing for a change in orientation though. Were you pointing > to something in particular in the Activity documentation?
Here's another idea for an indirect approach. Going through the onPause/onStop/onStart/onResume procession should take only so long; fractions of a second. What you could try is to detect when the Activity is unbound and bound again within the Service itself (override Service.onUnbind()) . You can use a timer in the overriden onUnbind() that runs for that fraction of a second (plus change), and when the timer triggers, check if the Activity has been bound again. If not, stop the player. I find this an elegant solution in that control remains with the service itself. You also have a platform to track multiple activities being bound (you may need this as you develop your UI), and you would consider stop playing only after the last activity was unbound. The downside - it'll introduce a slight delay when the activity is closed for good, but it should be barely noticeable. JP -- 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

