Sae*_*eid 7 android android-download-manager
我需要以这种形式为我的应用程序创建一个动态下载管理器:
从自定义列表中删除完整下载
像这样 
起初我使用此站点代码进行线程下载.
然后,我创建一个自定义列表视图,每次用户单击"下载"按钮时,将添加该下载链接.
但我有两个问题:
现在,问题是:我如何为我的应用程序创建一个动态下载管理器,可以添加具有暂停/恢复功能的列表的新链接,并从自定义列表中删除下载的项目?
编辑 - 添加Custom-Listview
我在此链接中的自定义列表视图:https://github.com/saeid-pm/Custom-Listview
最后大约1年后(:D)这是最好的解决方案之一:
通过添加到带有库的项目来使用此库,
或Android Studio依赖项:
 dependencies {
    compile 'com.mani:ThinDownloadManager:1.3.0'
 }
它是最好的和快速(任何)文件下载库之一,太简单易用和自定义.
例如在我的问题(1年前)中i wanted to have Multiple-File-Download,轻松可以通过以下方式指定线程池大小:
ThinDownloadManager downloadManager = new ThinDownloadManager(DOWNLOAD_THREAD_POOL_SIZE); 
//DOWNLOAD_THREAD_POOL_SIZE = number of threads.
祝好运!.
编辑以回答@Bhuvi,(设置目标下载文件)
定义文件目标:
        String fileName ="file name";
        File root = android.os.Environment.getExternalStorageDirectory();
        File dir = new File(root.getAbsolutePath() +`subfolder name`);
        if (dir.exists() == false) {
            dir.mkdirs();
        }
        final Uri destinationUri = Uri.parse(dir + fileName);
然后setDestinationURI(你的路径)ThinDownloadManager
downloadRequest = 
  new DownloadRequest(downloadUri)setDestinationURI(destinationUri).setPriority(DownloadRequest.Priority.HIGH)
编辑@ farhad.kargaran回答 - 2017/12/06
正如我看到ThinDownloadManager存储库,最后一个版本是1.3.0但是根据@ farhad.kargaran回答有版本1.4.0,我还没有测试新版本的功能,但你也可以根据@ farhad.kargaran的答案测试新版本.
| 归档时间: | 
 | 
| 查看次数: | 9914 次 | 
| 最近记录: |