Reputation: 2097
I have an IntentService which does some image processing. In my Activity, I have a cancel button which needs to send a message to the service (a boolean value) so that it should stop when it has finished processing the current image.
I know I can pass values to a service before calling startService() via the intent.putExtra() method. But in this case, I need to send the boolean variable to the IntentService while it's running.
How can I do this?
Thank you.
Upvotes: 0
Views: 599
Reputation: 266
Use Broadcasts, register a broadcast receiver in your service and send broadcast from your activity to the service.
Upvotes: 1