2011-04-23 17 views
2

今天我很抱歉提出了太多問題,但我真的需要你的幫助來完成這個應用程序。 在我的doInBackground(asynctask)中: 一個循環,用於解析某些提要並用結果填充列表。 在我的onPostExecute: 上面構造的結果列表發送給ListAdapter以顯示結果。doInbackGround中的Android停止任務並返回postExecute

它是一種方式來中斷在doInBackground環路(同時顯示進度對話框) 並返回列表中onPostExecute?

謝謝。

回答

4

有一種方法可以中斷doInBackground中的循環,然後執行onCancelled。您應該使用isCancelled檢查doInBackground中的取消狀態。

+0

謝謝,'onCancelled'解決了這個問題,所以我從'onPostExecute'放了相同的代碼,我得到了預期的結果。 – Houssem 2011-04-24 07:47:31

相關問題