Android的AsyncTask的问题 [英] Android's AsyncTask issue

查看:116
本文介绍了Android的AsyncTask的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提出建议如下: 我试图执行从Android的帮助页面code,但它不为我工作:

could anyone advise on the following: I'm trying to execute code from Android's help page, but it doesn't work for me:

public class DownloadFilesTask extends AsyncTask<String, Integer, Long> {
        protected Long doInBackground(String... urls) {
            Log.e("TuneWiki", "Exec");
            return 1l;
        }

        @Override
        protected void onPostExecute(Long result) {
            Log.e("TuneWiki", "Post");
        }
}

当我执行任务,doInBackground调用正常,但onPostExecute永远不会被调用:(

when I execute task, doInBackground is invoked fine, but onPostExecute is never invoked :(

在测试了Milestone采用2.1 OS

Tested on Milestone with 2.1 OS

推荐答案

谢谢大家 - 我找到了原因。 AsyncTask的停止出于某种原因,如果很多线程,即使所有的线程已成功完成之前开始工作。

Thanks everyone - I found the reason. AsyncTask ceases working for some reason if a lot of threads were started before even if all threads were successfully completed.

这篇关于Android的AsyncTask的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆