无法从webview android查看下载的文件

无法从webview android查看下载的文件,android,webview,android-download-manager,Android,Webview,Android Download Manager,我正在使用下面的代码从webview下载文件 if(!url.contains("sharepoint.com")) { if (url.endsWith(".pdf") || url.endsWith(".PDF") || url.endsWith(".xls") || url.endsWith(".xlsx") || url.endsWith(".XLSX") || url.endsWit

我正在使用下面的代码从webview下载文件

if(!url.contains("sharepoint.com")) {
            if (url.endsWith(".pdf") || url.endsWith(".PDF") ||
                    url.endsWith(".xls") || url.endsWith(".xlsx") ||
                    url.endsWith(".XLSX") || url.endsWith(".XLS") ||
                    url.endsWith(".txt") || url.endsWith(".TXT") || url.endsWith(".doc") || url.endsWith(".DOC") ||
                    url.endsWith(".docx") || url.endsWith(".DOCX") || url.endsWith(".ppt") || url.endsWith(".PPT") ||
                    url.endsWith(".pptx") || url.endsWith(".PPTX") || url.endsWith(".rtf") || url.endsWith(".RTF") ||
                    url.endsWith(".csv") || url.endsWith(".CSV")) {
                mWebView.setDownloadListener(new DownloadListener() {
                    public void onDownloadStart(String url, String userAgent,
                            String contentDisposition, String mimetype,
                            long contentLength) {
                        DownloadManager.Request request = new DownloadManager.Request(
                                Uri.parse(url));
                        final String fileName= URLUtil.guessFileName(url,contentDisposition,mimetype);
                        Log.d("ss","fileName:"+fileName);
                        request.allowScanningByMediaScanner();
                        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
                        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
                        DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
                        dm.enqueue(request);
                        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); //This is important!
                        intent.addCategory(Intent.CATEGORY_OPENABLE); //CATEGORY.OPENABLE
                        intent.setType("*/*");//any application,any extension
                        startActivity(intent);
                    }
                });
            }
        }
我的url是“”


但我无法查看我下载的文件。您能建议我查看下载的文件吗?

您需要实际指定类型。没有应用程序可以打开*/*,这意味着它可以打开任何存在的文件。@Gabe Sechan我也尝试过。但它不起作用。其显示“无法访问文件请检查位置或网络,然后重试”。