You can use JSON formatted string and then eval() it in JS code

On May 12, 10:56 am, "Mark Murphy" <[email protected]> wrote:
> > I made a webview.addjavascriptinterface(geo, "geo");
> > to access the geo class from javascript,
> > and, in the html-javascript I write:
> > ---------
> > function successCallback(p){
> >       document.write("helo");
> > }
> > geo.getCurrentPosition(successCallback);
> > -----------
> > but this is not working, maybe someone made something like this? I want to
> > pass a javascript function to that java function, but maybe is can't be
> > that
> > way.
>
> > any Idea are wellcame.
>
> I do not believe what you are trying to do is possible.
>
> However, if the successCallback() is a global function, Java can create a
> javascript: URL to invoke it:
>
> webView.loadUrl("javascript:successCallback()");
>
> The catch is that you are very limited as to what you can pass as values
> to the callback function -- it has to be something that can be embedded as
> literal values in the source code snippet you are executing.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to