0
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);
}
});
如何下載,而無需打開瀏覽器.. 我搜索過網,但coudnt找到解決方案的Android數據..布勞爾打開,同時下載
或者有什麼訣竅與該用戶不能看到網絡瀏覽器在歡迎 ,我新手,所以試圖解釋 請幫助我與它提前感謝.. :-)
有沒有辦法通過我的問題顯示的方法..btw謝謝4回答 –
使用AsyncTask wouldn打開瀏覽器,這基本上是你試圖暗示的東西嗎? – Vyshak