在android下载线程文件?

时间:2013-10-18 11:34:06

标签: java android multithreading

我在运行时创建了一个线程。每个线程都从soap获取文件。我一次下载多个文件。但线程超过350 kb文件无法下载。如何解决这个问题呢?我是android的初学者。

1 个答案:

答案 0 :(得分:1)

use **intent service** dear it will always running while your process is not completed 



public class MyIntentService extends IntentService {







    public MyIntentService() {
        super("com.example.androidintentservice.MyIntentService");
    }

    @Override
    public void onCreate() {
        // TODO Auto-generated method stub
        super.onCreate();

    }

    @Override
    protected void onHandleIntent(Intent intent) {

        try {
                          DO YOUR TASK HERE 



            }



        } catch (Exception e) {
            e.printStackTrace();

        }

        // return result
        Intent intentResponse = new Intent();
        intentResponse.setAction(ACTION_MyIntentService);
        intentResponse.addCategory(Intent.CATEGORY_DEFAULT);
        intentResponse.putExtra(EXTRA_KEY_OUT, extraOut);
        sendBroadcast(intentResponse);
    }



}