Hello Christer.

Have you tried that line without the Hello?

webview.setWebViewClient(new WebViewClient());



-----Original Message-----
From: android-beginners@googlegroups.com
[mailto:android-beginn...@googlegroups.com] On Behalf Of Christer Østergaard
Sent: Thursday, September 03, 2009 11:06 AM
To: Android Beginners
Subject: [android-beginners] HelloWebView - WebViewClient odd behaviour


Hi everybody,

Have been going through the HelloWebView tutorial. First I did all the
coding my self. Went perfectly fine. Loaded the Google address. Then I added
the code for HelloWebViewClient. As soon as I added the
webview.setWebViewClient(new HelloWebViewClient()); I end up getting nothing
but black in the content area.

After working a bit with it, I reversed everything, and copied the code from
the tutorial. Same behaviour. If I take the aforementioned line of code out,
then it works again.

Does anyone have a clue to why this is happening?

Kind regards,
Christer

public class HelloWebView extends Activity {
    /** Called when the activity is first created. */
    private WebView webview;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new HelloWebViewClient());
        webview.getSettings().setJavaScriptEnabled(true);
        webview.loadUrl("http://www.google.com";);

    }

    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String
url) {
            view.loadUrl(url);
            return true;
        }
    }


}


No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.13.71/2332 - Release Date: 9/2/2009
6:03 PM


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to