I've already bound an activity to my service following this tutorial. http://developer.android.com/guide/components/bound-services.html
I'm able to call service functions, but what if I want to for example, change some of my textviews or disable some of the toggle buttons because of work done on the service (and from the service). Would there be an easy to way to do this?
You can use messages to send information between activities and services. This is an easy way to send simple data, but may not be the best option if you need to send data very frequently, or send complicated data. This is an example of some code I have in one of my apps with a service and an activity which communicate:
Code in the activity:
Code in the service: In the service, you will want to have code (very similar to the code in the activity) to receive a message and save the
msg.replyTo
field as aMessenger
object. There is an example somewhere which will have you make an object and then use an IncomingHandler like this:This can allow your service to keep track of multiple clients at once and send messages to specified clients. To send a message simply use something like this: