Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从链接android java下载文件时出现问题_Java_Android_Download - Fatal编程技术网

从链接android java下载文件时出现问题

从链接android java下载文件时出现问题,java,android,download,Java,Android,Download,我有一个链接,如果我们去的话,.mp4文件将被自动下载,但是如果尝试使用下载管理器,那么文件将被保存为.html格式,我想要在.mp4中 String ID = "https://presaver.com/download/9Tw-f3i-08k/22"; DownloadManager downloadmanager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);

我有一个链接,如果我们去的话,.mp4文件将被自动下载,但是如果尝试使用下载管理器,那么文件将被保存为.html格式,我想要在.mp4中

String ID = "https://presaver.com/download/9Tw-f3i-08k/22";
 DownloadManager downloadmanager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
        Uri uri = Uri.parse("ID");
        DownloadManager.Request request = new DownloadManager.Request(uri);
        request.setTitle("YoutubeVideo");
        request.setDescription("Downloading youtube video");
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setVisibleInDownloadsUi(true);
        request.setDestinationUri(Uri.parse(path));
        downloadmanager.enqueue(request);

我想你写错了这句话

Uri uri = Uri.parse("ID");
应该是

Uri uri = Uri.parse(ID); // string ID

(Uri.parse(path))
路径的值是多少?或者尝试将
https
更改为
http