Run another AsyncTask in onPostExecute()

前端 未结 2 1125
醉梦人生
醉梦人生 2021-01-11 13:00

What if I need to run another async task being in another async task, meaning in onPostExecute() method, how to do so?

2条回答
  •  情书的邮戳
    2021-01-11 13:59

    You can try the following code to create a NewAsyncTask in onPostExecute and then execute the new task.

    @Override
    protected void onPostExecute(String result) {
        NewAsyncTask newtask = new NewAsyncTask();
        newtask.execute();    
    }
    

提交回复
热议问题