Possible Duplicate:
Example: Communication between Activity and Service using Messaging
I'm having a trouble with my service, I googled from yesterday to now and got nothing decent result.
Now I have a activity with some buttons ( Play/Pause, Next, Previous) and a service (contains a MediaPlayer and others). I want to control my service to do somethings when I press a button on Activity.
I got how to send data from activity to service but that causes my problem.
To connect to service, I used startService(intent) with intent included some data, and in service class, I overrode onStartCommand(...) and now my service received that data.
That's great, but now I can not control my service.
And then, I approached to another way - Bound Service.
I also got how to create a bound service class and connect to it to interact with. But now, because onstartCommand is only called by startService() so I don't know how to get data from activity without override this method.
My question is: How to let activity control and send data to a service? Thank you.