android: Android Webview cannot render the pdf sometimes and shows blank/white page instead
Steps to Reproduce
- Open the pdf in the webview using google docs link.
- Open the same pdf or different pdf again and again.
- Sometimes it will show the blank/white page in the android untill we refresh the webpage again for 1 or 2 times.
Code
public void SetWebView(WebView webview,string externalUrl){
webview.Tag = "webview";
webview.Settings.JavaScriptEnabled = true;
webview.Settings.SupportZoom ();
webview.Settings.SetAppCacheEnabled(true);
webview.Settings.DomStorageEnabled = true;
webview.ZoomOut ();
webview.ZoomIn ();
webview.Settings.BuiltInZoomControls = true;
webview.Settings.LoadWithOverviewMode = true;
webview.Settings.UseWideViewPort = true;
//webview.Settings.SetSupportZoom (true);
webview.Settings.SetPluginState (WebSettings.PluginState.On);
webview.Settings.GetPluginState ();
if (externalUrl.StartsWith("http://") || externalUrl.StartsWith("https://"))
webview.LoadUrl (externalUrl);
webview.SetWebViewClient (new MonkeyWebViewClient (imgViewBack, imgViewForward, imgRefresh));
webview.SetWebChromeClient (new WebChromeClient ());
`}`

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 16 (4 by maintainers)
If you’re getting the same problem in Android Studio, that means it’s probably just a general problem with Android, sorry 😞 .
I think you should try posting on either:
Closing for now, since I don’t think it’s an issue with Xamarin.Android, but let us know otherwise, thanks!
I was able to solve this https://medium.com/@mr.kante416/pdf-in-webview-android-1380de57155c shared in this article now well written will update in some time.
Same issue with me also
I will try to create a small application to reproduce the same issue. As per your need I send the information about the environment below:
Hello, @gopalawasthi123
Would you mind creating a small application to reproduce the issue? We’d also need more information about your environment, specifically:
Thanks!