I have an arcive of several files format like JPG, PDF, ZIP and I want to download the files into my app. The PDF and ZIP files are being downloaded well but I can not download the JPG files. Any idea how can I download the JPG files as well?
HTML page here http://www.sotkora.com/xy/ex_download.html
public class DownloadingExample extends Activity {
WebView webView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_downloading_example);
this.webView=(WebView) this.findViewById(R.id.webView_IF);
this.webView.getSettings().setSupportZoom(false);
this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
this.webView.loadUrl("http://sotkora.com/xy/ex_download.html");
this.webView.setWebViewClient(new WebViewClientDemo());
this.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);
}
});
}
private class WebViewClientDemo extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
HTML code:
<div><a href="http://www.sotkora.com/xy/images/rose.jpg" download="JPGPhoto">Download JPG Photo</a></div><br/>
<div><a href="http://www.sotkora.com/xy/files/load_test.pdf" download="pdf_test">Download PDF File</a></div><br/>
<div><a href="http://www.sotkora.com/xy/files/load_test.zip" download="ZIP_test">Download ZIP File</a></div><br/>