简体   繁体   English

android webview有时无法通过loaddatawithbaseurl显示内容

[英]android webview can not show content by loaddatawithbaseurl sometime

I use webview to load local html data like this 我使用webview这样加载本地html数据

webview.loadDataWithBaseURL("about:blank", finalSrc, "text/html", "UTF-8", null);

the finalSrc is a variable of html string. finalSrc是html字符串的变量。

sometimes, the webview can display the corrent content,but sometimes not. 有时,Web视图可以显示当前内容,但有时不能。

and I found that if I clear the cache of my app, the webview works well again. 而且我发现,如果我清除应用程序的缓存,则webview会再次正常运行。

so what's wrong with my app? 那么我的应用程序怎么了?

rather than using BaseUrl why don't use loadData. 而不是使用BaseUrl,为什么不使用loadData。 for example webview.loadData(finalSrc, "text/html", "UTF-8"); 例如webview.loadData(finalSrc, "text/html", "UTF-8");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM