Java : a WebService asking embeded in a AsyncTask

后端 未结 2 1954
感动是毒
感动是毒 2020-12-12 07:04

. Hi, as a young android developer i was looking at a way to get a JSON response from a server. I started looking at AsyncTask but i not feeling comfortable to code an Async

相关标签:
2条回答
  • 2020-12-12 07:35

    Can I just point out that, because you are not doing this in a Service, your remote query stands every chance of being killed, as soon your Activity is hidden. You have, essentially, rewritten IntentService... except that your version will get killed and the version the framework provides, free, will not

    IntentService, FTW

    0 讨论(0)
  • 2020-12-12 07:44

    Your use of AsyncTask appears appropriate. As you may be aware.. for network communications you must use AsyncTask or your own thread (extend HandlerThread.)

    If your app is frequently calling AsyncTask or is executing simultaneous AsyncTask then creating your own thread will be more efficient (all AsyncTask requests use a single thread in API 13 and up.)

    I'm unfamiliar with your app and how it functions.. do your users require the dialogs and status feedback for thses background network transmissions?

    0 讨论(0)
提交回复
热议问题