这是我的WebView的代码。它在我到目前为止测试的每台设备上都很棒,甚至是三星S4。但是,某个三星S4,客户坚称它没有修改过的软件,每次从后台恢复应用程序时都会显示白屏。有什么想法吗?
private void setupWebView() {
// hide the no connection imageview
// show the webview
noConnectionImageView.setVisibility(View.GONE);
webView.setVisibility(View.VISIBLE);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedSslError(WebView view,
SslErrorHandler handler, SslError error) {
handler.proceed();
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
showNoConnectionImage();
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
// page has started loading
if (mustShowSplashScreen) {
showSplashScreen();
}
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
// page has finished loading
if (mustShowSplashScreen) {
hideSplashScreen();
mustShowSplashScreen = false;
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// check for Internet connection
if (ConnectionDetector.isConnected(Main.this)) {
// check if link is external
if (isExternalUrl(url) {
// external link
new OpenLink(Main.this, url);
} else {
// internal link
view.loadUrl(url);
}
} else {
showNoConnectionImage();
Main.this.url = url;
}
return true;
}
});
}