Android HTTP Request AsyncTask

前端 未结 3 764
后悔当初
后悔当初 2020-12-03 12:59

I want to implement a class which will handle all HTTP Requests of my application, which will be basically:

  • Get a list of business (GET);
  • Execute a lo
3条回答
  •  悲&欢浪女
    2020-12-03 13:46

    You are not executing the task. You are just creating it. I think you need to make:

    Get g = new Get();
    g.execute();
    

    But you are using the lifecycle of the task in a wrong way. OnPostExecute runs on the Main thread, where you should do all the updates as needed. You can pass the task a View for example.

提交回复
热议问题