Catch Exception in JavaScript

by kevin » Wed, 08 Apr 2009 19:47:38 GMT

Sponsored Links
 My application uses WebView to load javascript which calls into Java
class (through webview javascript iterface). Can the JavaScript catch
exceptions thrown from Java? This is very important for the
application, any help is appreciated.


Catch Exception in JavaScript

by kevin » Thu, 09 Apr 2009 11:35:48 GMT

 Anyone can help on this? I tried to catch exception in javascript but
doesn't work, is it because webview not support javascript exception



Sponsored Links

Catch Exception in JavaScript

by Mattaku Betsujin » Thu, 09 Apr 2009 11:43:57 GMT

 I think the answer is no. If java JavaScript calls Java, and the Java method
throws an uncaught exception, it kills the app process.

Your best bet is to put a try-catch block around every Java method that can
be called by Javascript.

Just curious. What kind of exception are you expecting? I have written quite
a bit of JavaScript -> java calls in my app and this has never been an issue
for me.
2009/4/8 kevin <>


Catch Exception in JavaScript

by kevin » Tue, 14 Apr 2009 09:56:08 GMT

 My javascript calls Java to do IO operation, I was trying to catch
IOException inside javascript.



Other Threads

1. Pushing the Envelope...

I have a G1 and an N1.

I have loved them both.

I sure hope Google keeps putting out smartphones and tablets that push the 

I am dismayed by the lock-in lock-down machinations of the other providers.


2. Handling the R object in a library

I moved some of my useful utility code into a library where multiple
projects can easily access it. Among those utility classes is one that
parses values out of some files in the res folder using the following

                myXmlParser =

Where passedInContext is of type Context and passedInResourceID is an
int and both are passed into the utility class from the calling

When I build a project that uses the library I get the following

 --custom-package generates into a different package.

What should I do to get an XmlResourceParser or XMLPullParser for an
xml file in the res folder in this case?


3. getting a java.lang.VerifyError

4. Wifi: No scan results

5. Android bitmap allocation weirdness

6. Sharing code between apps as in Eclipse

7. copybit format conversion issue, for help