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)
i haven't compared your code closely with the sample (although I notice it uses IRunnable), but maybe it'll give you a hint? cd On Fri, Aug 3, 2012 at 8:53 PM, jose medrano <jmedranojime...@hotmail.com>wrote: > #### MONODROID CODE ##### > > protected override void OnCreate(Bundle bundle) > { > [...] > LinearLayout layout = > FindViewById<LinearLayout>(Resource.Id.MyLayout); > var webView = new WebView(this); > webView.SetWebChromeClient(new WebChromeClient()); > webView.Settings.JavaScriptEnabled = true; > webView.AddJavascriptInterface(new JSAccesibleObject(), > "cSharpObject"); > webView.LoadUrl("file:///android_asset/test.html"); > layout.AddView(webView); > } > > public class JSAccesibleObject : Java.Lang.Object > { > public void method1() > { > > } > } > > > #### END MONODROID CODE ##### > > > In Javascript, cSharpObject is defined, but it has no properties. > > #### JAVASCRIPT CODE ##### > > alert(cSharpObject); //mynamespace.Activity1_JSAccesibleObjec@f4438fe8 > for (var prop in cSharpObject) > alert(prop); //this never gets called > alert(cSharpObject.method1) //undefined > alert(cSharpObject.method1()) //fails > > #### END JAVASCRIPT CODE ##### > > Am I doing something wrong, or does this just not work in MonoDroid? > > > > > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/Using-webView-AddJavascriptInterface-with-MonoDroid-tp5711150.html > Sent from the Mono for Android mailing list archive at Nabble.com. > _______________________________________________ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid >
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid