On Jun 4, 4:49 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Michael Thomas wrote:
> > would it be better to just
> > try {
> >    window.phz.backbutton ()
> > } catch ()
>
> > instead? this need to be cross-browser safe.
>
> Oof. That could be trouble.

Well, both methods _do_ work. What do you mean by trouble anyway?
And why would a try/catch block be a problem? The native method isn't
what's
throwing the error, it's the _lack_ of the jsi method (ie, on a non-
android
device). Surely the jsi method isn't disallowed from being inside
a try/catch block.

>
> Can't you sniff on browser type and serve up the proper HTML based on
> whether it's an Android device?

That's a generally frowned upon way of detecting things.

>
> > I have noticed that the normally implicit .toString() js method causes
> > chunks to be blown,
> > so I'm not doubting you :)
>
> If you mean that a returned string from Java is not really a Javascript
> string, I know what you mean. Concatenate an empty string on the Java
> return value to force it to become a Javascript string, where needed.

No, just (""+window.phz) (ie, the javascript interface object's
implicit .toString() method in js)
causes the process to blow off. Annoying, but not a huge deal.

Mike
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to