berguiz
berguiz

Reputation: 1

Share datas at the end of a Service


I would like to have your opinion.
I have got an Activity A with a button (and a listener of course). It starts a Service and a Notification. I would like that when I click on the notification, it runs a new Activity B and it stops the Service.
My problem is : how use an Indent to send the datas from the Service to the Activity B when the Service is stop?
(I need the very last values of datas in my Service)
Thanks in advance for yours answers.

Upvotes: 0

Views: 29

Answers (2)

sushantsha
sushantsha

Reputation: 81

Before calling stopSelf() on the service you should start the Activity B with the intent (say I). Immediately after calling startActivity(B, I), you should call stopSelf on service.

While creating I, you can put data into the intent as EXTRAs.

Upvotes: 0

ci_
ci_

Reputation: 8774

Intent has a couple of methods called putExtra(String name, ...) which allow you to put a number of EXTRAS on the intent. You don't specify a whole lot of detail in your question. This is the most generic answer I can give you.

Upvotes: 1

Related Questions