问题
When I'm loading a page using .loadData
or .loadDataWithBaseURL
, the system will load a page once.
After that, subsequent calls do not work.
In 4.0.3, if I were to call the function a second time with new data, it does change.
How can I fix this for 2.2+? Do I destroy the webview and create a new one?
webView1.loadDataWithBaseURL("file://", page, "text/html", "UTF-8", null);
webView1.loadUrl( "javascript:window.location.reload( true )" );
回答1:
In loadDataWithBaseURL, set the last parameter to the URL where that data came from, instead of null
.
回答2:
I think it should be "file:///"
. You just missed one slash.
来源:https://stackoverflow.com/questions/9960443/android-v2-2-2-3-5-webview-loaddatawithbaseurl-will-only-load-page-once