zoukankan      html  css  js  c++  java
  • 开源项目实现多线程下载 (xutils)

     public void download(View v){
            EditText et_url = (EditText) findViewById(R.id.et_url);
            String url = et_url.getText().toString().trim();
            //1.创建httpUtils对象
            HttpUtils httpUtils = new HttpUtils();
            //2.调用download方法  url:下载的地址  target:下载的目录   callback:回调 
            httpUtils.download(url, "/sdcard/feiqiu/feiq.exe", new RequestCallBack<File>() {
                @Override
                public void onLoading(long total, long current, boolean isUploading) {
                    System.out.println("total:"+total+";current:"+current);
                    super.onLoading(total, current, isUploading);
                }
                @Override
                public void onSuccess(ResponseInfo<File> responseInfo) {
                    System.out.println(responseInfo.result);
                }
                @Override
                public void onFailure(HttpException error, String msg) {
                    // TODO Auto-generated method stub
                    
                }
            });
        }

  • 相关阅读:
    虚基类、虚函数与纯虚函数
    从尾到头打印链表
    Login
    (转)学习技术的三部曲:WHAT、HOW、WHY
    win7mstsc连接电脑
    C#面试题
    ASP.net C#笔记 (一)新建三层项目
    asp.net (一) 语法
    云服务器寻找
    VB.net笔记 (二)内置对象
  • 原文地址:https://www.cnblogs.com/xufengyuan/p/5847181.html
Copyright © 2011-2022 走看看