In accordance with advice of many I'm trying to use goolge docs to show a pdf in a WebView.
Here is my code:
@SuppressLint("SetJavaScriptEnabled")
public void setDocumentPath(final String path) {
WebView webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginsEnabled(true);
webView.loadUrl("https://docs.google.com/viewer?url=http://www.selab.isti.cnr.it/ws-mate/example.pdf");
}
The PDF is just some example I found online. It works in my browser, but on my android emulator and device it displays a "Webpage not available".
Both are running android 4.0.
Is there anything obvious I'm missing? Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…