2017-12-11 3 views
1
webView.setDownloadListener(new DownloadListener() { 
     public void onDownloadStart(String url, String userAgent, 
            String contentDisposition, String mimetype, 
            long contentLength) { 

      Uri uri = Uri.parse(url); 
      Intent intent = new Intent(Intent.ACTION_VIEW,uri); 
      startActivity(intent); 
     } 
    }); 
+1

スタックオーバーフローへようこそ。 [良い質問をするにはどうすればいいですか?](https://stackoverflow.com/help/how-to-ask)と[ここではどのような話題がありますか?](https://stackoverflow.com/help)をお読みください。/on-topic)。 **研究、何かを試し、あなたのコードを追加し、あなたの問題を指摘する**。 – pirho

答えて

0

mWebView.setDownloadListener(new DownloadListener() { 
    public void onDownloadStart(String url, String userAgent, 
       String contentDisposition, String mimetype, 
       long contentLength) { 
     Intent i = new Intent(Intent.ACTION_VIEW); 
     i.setData(Uri.parse(url)); 
     startActivity(i); 
    } 
}); 

はまた読み取り許可を追加してみてくださいと外部ストレージを書く試してみて、読み書きの許可をランタイム許可を使用する必要があるのWebViewでファイルをダウンロードすることができません