使用android中的下载管理器类无法下载名称中包含特殊字符的文件

时间:2017-01-24 18:10:00

标签: android

我没试过" - "符号叹息那段时间它工作正常,但使用此文件无法从我的服务器下载文件 这是我的代码

Button b1,b2;
String dwnload_file_path = "http://www.drvrgit.com/0APK/BCA/T-1 Java History, Introduction, Basics.doc";
DownloadManager downloadManager;
b1 = (Button)findViewById(R.id.button5);   
        b1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
                Uri uri = Uri.parse(dwnload_file_path);
                DownloadManager.Request request = new DownloadManager.Request(uri);
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                //request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"IOStreams.pdf");

                Long referance = downloadManager.enqueue(request);

            }
        });

0 个答案:

没有答案