我正在尝试在Android版本4.3的webview中加载HTTPS网址,但无法加载它。我试过这些链接:
Executing in emulator and here is the sample screenshot
这是代码
public class MainActivity extends Activity {
private WebView webView;
Activity activity ;
private ProgressDialog progDailog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
activity = this;
progDailog = ProgressDialog.show(activity, "Loading","Please wait...", true);
progDailog.setCancelable(false);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
progDailog.show();
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
progDailog.dismiss();
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// TODO Auto-generated method stub
super.onReceivedError(view, errorCode, description, failingUrl);
System.out.println("WEB - "+description);
}
@Override
public void onReceivedSslError(WebView view,
SslErrorHandler handler, SslError error) {
// TODO Auto-generated method stub
super.onReceivedSslError(view, handler, error);
System.out.println(error+"------ ERROR");
handler.proceed();
}
});
webView.loadUrl("https://some _url.html");
}
}