阅读背景:

Brower在下载数据android时打开

来源:互联网 
WebView webview =(WebView)findViewById(R.id.webView);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl(URL);
    webview.setDownloadListener(new DownloadListener()
    {
        public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength)
        {
            //for downloading directly through download manager
            DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
            request.allowScanningByMediaScanner();
            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "download");
            DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
            dm.enqueue(request);
        }
    });
WebView webview =(WebView)findViewById(R.id.web



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: