[mono-android] Passing callback functions from Javascript to Mono

Jonathan Pryor jonp at xamarin.com
Mon Jun 11 15:22:15 UTC 2012


On Jun 11, 2012, at 9:36 AM, Terry151151 wrote:
> I have a JQuery script that calls a Javascript interface and I would like to pass two callback functions to Mono. When the C# function get called from the WebView the two functions are null. Any idea how to pass the callback functions?

I believe the answer is "you don't." Unfortunately, Android's documentation regarding what parameter types are allowed across the JavaScript/Java interface are...non-existant (that I could find), but some searching found:

	http://stackoverflow.com/a/9522528/83444
	https://groups.google.com/group/android-developers/browse_thread/thread/fbc0553efd96c0ff

It looks like you can only pass Strings and primitives from JavaScript to Java. Functions, collections, etc. are out.

 - Jon



More information about the Monodroid mailing list