Issue
I am using WebView to open a url which is in fact a pdf document. Here is the code snippet.
WebView webView = (WebView) context.findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl("http://www.stagecoachbus.com/PdfUploads/Timetable_28768_5.pdf");
And the error obtained is:
EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up
I was able to open normal web pages. However, opening pdf files results in exception.
Any thoughts?
Thanks in advance!
Solution
To open pdf in Webview , it better to show pdf via google doc service
WebView webView = (WebView) context.findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl("http://docs.google.com/gview?embedded=true&url=http://www.stagecoachbus.com/PdfUploads/Timetable_28768_5.pdf");
It help you to show pdf.
Answered By - Md Abdul Gafur
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.