Reputation: 37
Why is it happening?
public class MainActivity extends Activity
{
WebView browser;
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.activity_main);
//browser.getSettings().setJavaScriptEnabled(true);
browser = (WebView)findViewById(R.id.webkit);
browser.loadUrl("www.microsoft.com");
}
}
But when I run the Android HTML5 app I get this screen goo.gl/uDkj1
I also tried other possibilities such as http:// in front or end the address with a slash and so on.
Upvotes: 1
Views: 8863
Reputation: 12249
Make sure you have the Internet permission set in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Edit:
browser.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
Upvotes: 3
Reputation: 12444
as the other answer said you must include the Internet
permission, but please note that
http://www.google.com
differ of www.google.com
so please include the protocol you are using in the URL
.
Upvotes: 0
Reputation: 72653
I'm guessing that you forgot to set the internet permission:
<manifest [...]>
[...]
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Upvotes: 3