Should I use AsyncTask or IntentService for my application?

前端 未结 8 643
陌清茗
陌清茗 2020-12-12 21:48

I have been reading around on internet connectivity with Android and noticed there are different ways to handle this i.e. AsyncTask and IntentService. However, I\'m still no

8条回答
  •  一生所求
    2020-12-12 22:35

    I agree with @DeeV and @ebarrenechea about Intent service in part that you should use it for task that are not tight bound with Activity like uploading some data to server or storing data from server to database.

    But starting from Android 3.0 there were introduced Loaders API Which should replace AsyncTask. So for example for loading list which you should display in Activity is better to use Loader which is designed to handle well all the configuration changes and Activity Life-cycle.

    Vogella loader tutorial

提交回复
热议问题