无法使用android中的下载管理器类下载名称中包含特殊字符的文件
我试过不带“-”符号,但这次效果很好,但这个文件无法从我的服务器下载 这是我的密码无法使用android中的下载管理器类下载名称中包含特殊字符的文件,android,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.s
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);
}
});
您从服务器收到的响应是什么?您可以尝试强制下载管理器使用UTF8编码,以确保服务器端代码也使用相同的编码