I ran (from your example on Page 160, modified for my application):
package com.GIMealPlanner;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class GIMealPlanner extends Activity {
WebView browser;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
browser.getSettings().setJavaScriptEnabled(true);
browser=(WebView)findViewById(R.id.webkit);
browser.loadUrl("http://www.giplanner.com/iphone");
}
}
and got:
Sorry!
The application com.GIMealPlanner (process com.GIPMealPlanner) has stopped
unexpectedly. Please try again. (Force close)
I ran it as Debug, but it "waiting for the debugger" (which I checked under
Applications)
On Sat, Dec 20, 2008 at 1:06 PM, Mark Murphy <[email protected]>wrote:
>
> > Have you enabled Javascript in your WebView?
> > *****NO - I just looked in your book & it says to"Control Javascript
> > via setJavaScriptEnabled()
> > (to disable it outright)" on page 167 - where does one do that? - our app
> > has tons of Javascript! - I want to enable it, not disable it outright
>
> It's disabled by default. A point which I should probably make a wee bit
> more forcefully in my book...
>
> Given a WebView named wv, to enable Javascript:
>
> wv.getSettings().setJavaScriptEnabled(true);
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 1.9 Available!
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---