2011-07-27 37 views

回答

1

做會聽連接變化廣播和取消任務時沒有連接可用,並且連接變得再次可用重新啓動它順理成章的事情。你可以檢查this Q準備好BroadcastReceiver。

1

文件說:

**Threading rules**

有一些線程規則必須遵循FO r該類正常工作:

任務實例必須在UI線程上創建。

execute(Params ...)必須在UI線程上調用。

不要手動調用onExExcute(),onPostExecute(Result),doInBackground(Params ...),onProgressUpdate(Progress ...)。

The task can be executed only once (an exception will be thrown if a second execution is attempted.) 

嘗試使用Handler,做取HTTP的東西,在Thread(您可以使用Thread.sleep(time);作出一定的時間線程休眠,當你認爲你已經準備好進行呼叫.sendMessage(message);,做從用戶界面更新處理器(handleMessage()runOnUiThread()方法),如果是需要的。

+0

所以你的意思是我必須使用手動線程,而不是AsysnTask來處理我的問題> ??> – sayvortana

相關問題