Hi Hassan, You can use the onPause() and onResume() functions for this. Just override the original functions and place the code to start your sound in onResume() and the code to stop your sound in onPause().
In case you have several activities that can be independently started and stopped, I'd use a static class with a counter of how many activities are active right now. Every time an activity executes onResume(), increase the counter by one, every time onPause() is called, decrease it by one. You can then stop your sounds in onPause() in case the counter is set to zero. Ditto for onResume(), where you only need to start your sound in case that static counter was zero beforehand. Haven't tried this though, just an idea. Best regards, Tobias On Jan 5, 7:14 am, Hassan Imtiaz <hassan.imt...@cprods.com> wrote: > Hi, > In my application i have several activities and i want to start > background music whenever my *Application* is launched and stop music > whenever *Application* is paused or stopped. > Any help?. > > Regards, > Hassan Imtiaz -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en