On Aug 10, 2012, at 1:05 AM, Craig Dunn <craig.d...@gmail.com> wrote:
> there's a recipe with code for that - so it should definitely work
> http://docs.xamarin.com/android/recipes/Controls/WebView/Call_C%23_from_JavaScript
> (which also links to 
> http://stackoverflow.com/questions/9745168/monodroid-javascript-call-back/9746911
>  )

That works...but is ~completely different. :-)

(Rephrased: we need to update that recipe.)

The reason the recipe works is because the JS2CS type implements IRunnable, and 
the JavaScript code is calling a run() method. Because the C# type implements a 
Java interface, the Android Callable Wrapper will implicitly implement all of 
the methods from the implemented Java interface (the run() method), allowing 
Java/JavaScript code to call it.

In Jose's case, he's not implementing a Java interface, and the method name 
he's using ("method1") likely won't exist in any existing Java interface 
either. This is where the Java.Interop.ExportAttribute custom attribute comes 
in, as it allows methods to be explicitly exported for invocation by Java.

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to