4

I have a short question. How can I send data from an activity to an already running service?

The approach is as following, I have a service running in the background, which is starting a new activity that is just showing an input window. And now I want to send the typed data back to the service. How can this be done?

Thanks in advance for helping! Best regards Tobi

frogatto
  • 28,539
  • 11
  • 83
  • 129
Tobi N
  • 554
  • 6
  • 22
  • Schildmeijer gave a clear anwser on a similair problem in another post. http://stackoverflow.com/questions/1916253/bind-service-to-activity-in-android – Pim Reijersen Jun 03 '11 at 09:32

1 Answers1

1

Are you aware of onBind method of Service class?

Kiril Kirilov
  • 11,167
  • 5
  • 49
  • 74
  • Oh, ok, perhaps I just thought to complicated... With the OnBind method I can give back a string within the intent, am I right? – Tobi N Jun 03 '11 at 09:31
  • were u rght at the end? how to read it in service? it's not same as activity2activity communication (getExtras..) 10q – Ewoks Jul 19 '12 at 14:12
  • 1
    So do we need to bind to share data with service then unbind and then again bind when we need to share data? Is this the correct way of communicating with a running Service from an Activity? – user65721 Jul 23 '13 at 22:04