Services help

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Services help

Postby Sport40L » Wed Dec 16, 2009 4:21 am

Hello,

I am designing an app using the MediaPlayer and just coded everything in my main Activity window. What I didn't realize is that in order to get the sound to run in the background I need to create a service. I want to be able to control the sounds from the main activity screen, so do I do this by simply moving the MediaPlayer object and methods over to the service.java file? Thank you in advance
Sport40L
Freshman
Freshman
 
Posts: 6
Joined: Thu Dec 03, 2009 6:21 pm

Top

Postby Dave09 » Wed Dec 16, 2009 9:40 am

Hello,

That is what I would do, and maybe use startService() in your main activity. Now, I have just started with Android but it would work at least. Maybe not the optimal way to do it. I have not yet learned what "bind(ing)" (or something about IPC?) is for exactly, but maybe that could be the good way to do it. Trying not to give false info here at least. Another way could be to send intents (messages) to the service (broadcasting it?). Not saying this is a good idea either.
Dave09
Freshman
Freshman
 
Posts: 4
Joined: Wed Aug 19, 2009 10:08 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google [Bot] and 6 guests