by my understand about looper that it’s can be a central for running by any request pass through
handler in message and Service can do that too. So what is adventage of each(priority of thread,reliable,resource,…) to decided to use.Any suggestion?
by my understand about looper that it’s can be a central for running by
Share
Work with
Handleri would say is basic approach, createThreadand implementHandlerbut if you work on more complex application, you should decide rather forAsyncTask, that is more complex, type safer, faster and offers more options. You can declare it like inner class or also separated class.Servicesis more complicated, you should know that only oneServicecan be in memory at the time, only one instance, one copy of Service and also when moreActivitiesare trying to connection toService. Services are generally used when you have very longTasksand you want to they keep running also when they are not connected with anyActivityfor example Music player, RSS, keep status on Chat etc. But this all not free so you have to care about CPU to prevent prematurely battery exhaustion for example.If i recommend to you so first try to use
AsyncTaskand when for something it’s won’t suitable for you or you need something what i wrote above, get it withService.More about AsyncTask and have look at this tutorial