WebView not working with INTERNET permission set

Go To StackoverFlow.com

1

I have a very simple application and I cannot make the WebView to show google.com (That's what I'm using to test

this is my Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bantol.mpp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MPPActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".SMSReceiver" >
            <intent-filter android:priority="100" >
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

this is the code I'm using in my MPPActivity:

    @Override
    public void onResume()
    {
        super.onResume();
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) 
            {
                return true;
            }
        });
        mWebView.loadUrl("www.google.com");
    }

The WebView shows Web page not available but no errors or messages on the LogCat

What am I missing?

I'm testing this on my device not the emulator.

2012-04-03 20:56
by SERPRO
Remove everything but the loadUrl() call and try it again. Guess you have a working connection on your device - WarrenFaith 2012-04-03 21:02


3

www.google.com is not a url, but http://www.google.com is. Fix your loadUrl() call to hold a proper url and it should work (if you have a valid connection, etc.).

2012-04-03 21:04
by mah
Hehehe... how easy was that.. Thanks - SERPRO 2012-04-03 21:08
Just a side note: You can say http://google.com as well - Davek804 2012-04-03 21:25
@Davek804 you mean http://google.com instead of http://www.google.com or just google.com - SERPRO 2012-04-04 09:08
Ooops! the URL that I typed, but not the one that showed up is indeed http : // url . co - Davek804 2012-04-04 17:42
Ads