I have created one android project with simple web view.
I am trying to open google. But the emulator screen is saying Google not available.
I have added Internet permission in the manifest file. Even I am able to access google from Emulator browser. Only in the application, I am not able access. Nothing is printed in the log also.
Please help.
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebViewClient(new HelloWebViewClient());
}
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
<uses-permission android:name="android.permission.INTERNET" />
remove or comment out this line
Since you have override
and returned yes, it might have meant that you have handled url loading. You basically don’t need the webviewclient subclass here