I know I should use Services in Android to do stuff in the background from a non-UI thread.
However, I would like to know what is wrong with just spawning a background thread to do the work from an Activity class (within an onClick event for example).
Thanks in advance.
Actually,
Services
are used for long running tasks, especially those, that run when your activity is not running.Threads
can be used for making some tasks inside your activity. This states, that aThread
, created inside yourActivity
, can not live outside of the activity that's created it, when aService
can. Hope this helps.