我想每隔几分钟运行一次后台 AsycTask。我创建了一个计时器并执行后台任务的 .execute 命令。我还创建了一个isChecking
在 BackgroundNotify 运行时为 true 的 bool。问题是我仍然收到以下错误:
01-26 15:09:32.871: E/AndroidRuntime(22332): FATAL EXCEPTION: Timer-0
01-26 15:09:32.871: E/AndroidRuntime(22332): java.lang.IllegalStateException: Cannot execute task: the task has already been executed (a task can be executed only once)
01-26 15:09:32.871: E/AndroidRuntime(22332): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:578)
01-26 15:09:32.871: E/AndroidRuntime(22332): at android.os.AsyncTask.execute(AsyncTask.java:534)
01-26 15:09:32.871: E/AndroidRuntime(22332): at de.tecfriends.vbtsplash2013.MainActivity$2.run(MainActivity.java:61)
01-26 15:09:32.871: E/AndroidRuntime(22332): at java.util.Timer$TimerImpl.run(Timer.java:284)
我究竟做错了什么?