最后大约1年后(:D)这是最好的解决方案之一:
或Android Studio依赖项:
dependencies {
compile 'com.mani:ThinDownloadManager:1.3.0'
}
它是最好的和快速(任何)文件下载库之一,太简单易用和自定义.
例如在我的问题(1年前)中我想要多文件下载,轻松可以通过以下方式指定线程池大小:
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);
>然后是ThinDownloadManager的setDestinationURI(您的路径)
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的测试新版本回答.