如何从 onPostExecute 内部重新启动 AsyncTask [英] How to Restart an AsyncTask from inside onPostExecute
本文介绍了如何从 onPostExecute 内部重新启动 AsyncTask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果 onPostExecute 无法从服务器加载数据,我想在对话框框上显示重新加载按钮.那么如何在 AsyncTask 中重新启动或执行类似操作?
I want to show Reload button on Dialoag box if the onPostExecute can not load data from server. So how can I restart or do something like that in AsyncTask?
推荐答案
再调用一次:
new mAsyncTask.execute("");
在数据未成功加载时 onPostExecute 的某些 if 块中.
in some if block of onPostExecute when data is not loaded succesfully.
这篇关于如何从 onPostExecute 内部重新启动 AsyncTask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文