[android-beginners] Re: HelloWebView - WebViewClient odd behaviour
Oops. :) I did not look at your lesson. I did however use webview for one of my first activities I built in Android after sucessfully completing the helloandroid lesson, and it worked a charm for me. Here is the code which works fine for me. HTH, Happy coding. Public class webtest extends Activity ( WebView webview; //declare webview variable @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); //link java code to xml gui webview.setWebViewClient(new WebViewClient()); //instantiate new webviewclient webview.getSettings().setJavaScriptEnabled(true); //enable javascript for this new webviewclient webview.loadUrl("http://www.google.com/";); //load web address } } -Original Message- From: android-beginners@googlegroups.com [mailto:android-beginn...@googlegroups.com] On Behalf Of Christer Østergaard Sent: Friday, September 04, 2009 2:10 AM To: Android Beginners Subject: [android-beginners] Re: HelloWebView - WebViewClient odd behaviour Hi, Thank you for your reply. Your suggestion actually takes away the point of the HelloWebView tutorial, in which we are shown how to intercept the actions and have more control over the view by creating a sub-class of WebViewClient. Anyways, of course, any input is appreciated, and actually, I do get the same behavior when using WebViewClient!!! This strikes me as very odd, because what we're basically doing is replacing default behaviour with default behavirour, no? Any suggestions? Thanks in advance, Christer On 3 Sep., 21:06, "tinyang" wrote: > Hello Christer. > > Have you tried that line without the Hello? > > webview.setWebViewClient(new WebViewClient()); > > 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/3/2009 6:05 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 -~--~~~~--~~--~--~---
[android-beginners] Re: HelloWebView - WebViewClient odd behaviour
Hi, Thank you for your reply. Your suggestion actually takes away the point of the HelloWebView tutorial, in which we are shown how to intercept the actions and have more control over the view by creating a sub-class of WebViewClient. Anyways, of course, any input is appreciated, and actually, I do get the same behavior when using WebViewClient!!! This strikes me as very odd, because what we're basically doing is replacing default behaviour with default behavirour, no? Any suggestions? Thanks in advance, Christer On 3 Sep., 21:06, "tinyang" wrote: > Hello Christer. > > Have you tried that line without the Hello? > > webview.setWebViewClient(new WebViewClient()); > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: HelloWebView - WebViewClient odd behaviour
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 -~--~~~~--~~--~--~---