Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a bundle be passed to a service?

In my application i need to get a value from an activity to a service. The value that i need to retrieve is the one i clicked in that activity.

For eg: If i select x[i] element from Activity A, i need to retrieve the value x[i] in a Service S.

How is it possible?

Thanks,

Niki

like image 319
Niki Avatar asked Mar 10 '11 10:03

Niki


1 Answers

In the service use this:

public int onStartCommand (Intent intent, int flags, int startId)
{
     super.onStartCommand(intent, flags, startId);
     Bundle bundle = intent.getExtras();
}
like image 76
Reno Avatar answered Sep 20 '22 18:09

Reno