I am working on app in which I need to open a pdf in a google doc with the help of a URL provided. I am using Web view for this. its working fine on all OS like 2.2., that I have tested but its not working on Android OS 4.1 device of my client.
if(NetworkAvailablity.checkNetworkStatus(ShowPdfInWebView.this))
{
WebView webview = (WebView) findViewById(R.id.pdf_webview);
String pdfURL=this.getIntent().getExtras().getString("PDFURL");
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdfURL);
}
I am using this code.
Please let me know, if it requires some different logic’s.
There is a nice trick to do that… you can use google docs to open your pdf in a WebView: