I follow this link Pass data from activity to service for understanding the passage of data from Activity to Service Android. The problem is that I need to pass a complex object to Service. How can I achieve this task?
You can make your complex object implement Serializable
or Parcelable
and then you can pass it to Service using putExtra(String name, Serializable value)
or putExtra(String name, Parcelable value)
Here you can find a tutorial for implementing Parcelable
and here Serializable
one.
If you aren't familiar with an any of them I would suggest you to use `Serializable' since it's more simple and pretty straightforward
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With