如何运行相同的AsyncTask不止一次?AsyncTask

由网友(泛黃的回憶)分享简介:我有我的AsyncTask运行活动时首次启动,那么,如果网络连接不可用,那么我有一个刷新按钮,尝试运行的AsyncTask再试一次。但我得到一个调试错误说这个.. I have my asyncTask run when the activity first starts, then if network conne...

我有我的AsyncTask运行活动时首次启动,那么,如果网络连接不可用,那么我有一个刷新按钮,尝试运行的AsyncTask再试一次。但我得到一个调试错误说这个..

I have my asyncTask run when the activity first starts, then if network connectivity is not available then i have a refresh button that tries to run the asyncTask to try again. But i get a debug error saying this..

07-29 18:14:21.290: ERROR/AndroidRuntime(9080): FATAL EXCEPTION: main
07-29 18:14:21.290: ERROR/AndroidRuntime(9080): java.lang.IllegalStateException: Cannot execute task: the task has already been executed (a task can be executed only once)
   07-29 18:14:21.290: ERROR/AndroidRuntime(9080):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:541)
   07-29 18:14:21.290: ERROR/AndroidRuntime(9080):     at android.os.AsyncTask.execute(AsyncTask.java:499)
  07-29 18:14:21.290: ERROR/AndroidRuntime(9080):     at com.fttech.gameIT.MainMenu$1.onClick(MainMenu.java:90)

反正有两次运行此?

Is there anyway to run this twice?

推荐答案

刚刚创建另一个实例并执行它。

Just create another instance and execute it.

阅读全文

相关推荐

最新文章