Opening a url with pdf file in a native android webview

717 Views Asked by At

I'm trying to open a pdf file in a Android WebView from a url.

When i searched for information online on how to achieve this, i found that you need to extend the url with this in front of it: "http://docs.google.com/gview?embedded=true&url="

I don't want to do like that.i just want to override the webview from the relevant pdf file.

My code snippet as below;

    WebSettings settings = webView.getSettings();
    String userAgent = settings.getUserAgentString();
    userAgent += "ABC";
    settings.setUserAgentString(userAgent);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.clearCache(true);
    webView.loadUrl(webViewUrl);
    webView.setWebViewClient(new WebViewClient(){ 
              ///..code here...}

Someone who knows about it,please help me on this matter??

0

There are 0 best solutions below