运行在onPostExecute另一个AsyncTask的() [英] Run another AsyncTask in onPostExecute()

查看:149
本文介绍了运行在onPostExecute另一个AsyncTask的()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我需要运行另一个异步任务异步的另一个任务是,这意味着在 onPostExecute()法,该怎么办呢?

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

推荐答案

作为一个建议,尝试过负荷的第一个的AsyncTask 成许多个时间的接听电话,你能够。但是,如果你的应用程序设计是这样一种方式,你只需要执行其他任务,一旦第一个任务完成,然后简单地执行第二的AsyncTask 完全一样的方式你正在做的第一个。

As a recommendation, try to off-load as many time's taking calls in your first AsyncTask as you can. However, if your application design is in such a way that you only need to execute another task once the first task is completed then simply execute the second AsyncTask exactly in the same way as you are doing for the first one.

@Override
protected void onPostExecute(String result) {
     new MySecondAsyncTask().execute(params);   //params if any
}

这篇关于运行在onPostExecute另一个AsyncTask的()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆