Danny
Danny

Reputation: 25

How to pass the parameters to service from an activity?

Hey , i am starting a service from a activity. I am calling the service from activity by startService();. But i want some variables from my activity to use in the services code which i am invoking in my activity, So please tell me how to do that?

Is there a way to pass the parameters to service from calling activity?

Thanks in advance!

Upvotes: 2

Views: 1875

Answers (1)

Nanne
Nanne

Reputation: 64409

You can add a Bundle to your intent (as an 'extra'). You can put all sorts of stuff (string, ints, bools, etc) in a bundle, and get them out later.

Upvotes: 4

Related Questions