Issue
I am trying to load HTTPS url in webview in android version 4.3 but unable to load it. I have tried these links:
Executing in emulator and here is the sample screenshot
Here is the code
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");
}
}
Solution
Try using Trusting SSL certificates make request may work for you See Here
Answered By - Ankitkumar Makwana
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.