I Have a Service and i interact with it from an activity using “Binding”.
Now, some of these methods that i’ve exposed to be called using binding, may take some time to complete (heavyweight).
How can run this in a seperate thread?
Should i, use threading in the “Activity” or in the “Service” ?
In general, if your task should be completed anyway (even if Activity is stoped) or if you need thread, that will listen for server updates, use Service. Else, use Activity.
Now you can do your task in background using these ways (in
ActivityorService– it doesn’t matter):1) Best way is to start AsyncTask.
2) Other way is to start Thread:
And read this: http://developer.android.com/guide/topics/fundamentals/services.html