Переопределение метода в вашей реализации WebViewClient,
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed(); // Ignore SSL certificate errors
}
Попробуйте следующий код, https работает для меня,
package org.example.webviewdemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
public class WebViewDemo extends Activity {
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
private WebView webView;
private EditText urlField;
private Button goButton;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create reference to UI elements
webView = (WebView) findViewById(R.id.webview_compontent);
urlField = (EditText)findViewById(R.id.url);
goButton = (Button)findViewById(R.id.go_button);
// workaround so that the default browser doesn't take over
webView.setWebViewClient(new MyWebViewClient());
// Setup click listener
goButton.setOnClickListener( new OnClickListener() {
public void onClick(View view) {
openURL();
}
});
// Setup key listener
urlField.setOnKeyListener( new OnKeyListener() {
public boolean onKey(View view, int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_ENTER) {
openURL();
return true;
} else {
return false;
}
}
});
}
/** Opens the URL in a browser */
private void openURL() {
webView.loadUrl(urlField.getText().toString());
webView.requestFocus();
}
}
main.xml
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/url"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:lines="1"
android:layout_weight="1.0" android:hint="http://"/>
<Button
android:id="@+id/go_button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/go_button"
/>
</LinearLayout>
<WebView
android:id="@+id/webview_compontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
/>