Android code for download file from webiew

How to make webview to download in android

I used ourSite variable to webview

Use following code for download file from webview

ourSite.setDownloadListener(new DownloadListener() {
       public void onDownloadStart(String url, String userAgent,
               String contentDisposition, String mimetype,
               long contentLength) {
         Intent downloadit = new Intent(Intent.ACTION_VIEW);

Import header file
// for downloadlistener
import android.webkit.DownloadListener;
//for webview
import android.webkit.WebView;

One Comment

Add your comments here

Back to Top