Possible Duplicate:
Download File inside WebView
I have a WebView on my screen:
webDownloadTicket = (WebView) findViewById(R.id.webViewToDownload);
webDownloadTicket.getSettings().setJavaScriptEnabled(true);
webDownloadTicket.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
// and load url
webDownloadTicket.loadUrl("xxx.com/TicketWEB/download.jsp");
// setup for download listener
webDownloadTicket.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
}
});
I was testing with browser, going to this URL and then press the download button, it will download a JSON file.
But when I test on my Android app with that code, it can load the web page but can not download anything when I press download button.