Android Programming and Technical Programming Technical

How to pass data from activity to service?
Options
1) pass data in intent-putextras, and using setResult()
2) pass data in intent-putextras, and say startService() with that intent
3) store it in common database and access it through both activity and service.
4) can be done using both the ways 2 and 3 options.

Read Solution (Total 0)

Android Other Question

Is it possible to have a service with multiple threads in it? How to achieve this?

Options
1) you can't have more than one thread in a service.
2) you can create multiple threads in a service
3) option 2 is possible by creating thread in onCreate()
4) option 2 is possible by creating thread in onStartCommand() of your service class.
Updating UI from service: How to access progress bar from a service?

Options
1) Send progressbar id through intent extras & access it in service
2) Make progress bar as static variable, and access that variable from service.
3) If you want to touch UI from service, trigger a dynamically registered receiver in activity from service, And update UI from that dynamic receiver with in that activity
4) put all UI controls in a common class and access it from all components.