views:

99

answers:

0

hi,

I'd like to call a JavaScript function out of Java (Android).

Well, the following source code works fine for me (source)

1 /** 2 * This is not called on the UI thread. Post a runnable to invoke 3 * loadUrl on the UI thread. 4 */ 5 public void clickOnAndroid() { 6 mHandler.post(new Runnable() { 7 public void run() { 8 mWebView.loadUrl("javascript:wave()"); 9 } 10 }); 11 }

My Problem now is to use a parameter for the JavaScript function.

Let's assume I've got some XML (just like AJAX somehow).

I need to escape it just like the iPhone / Objective-C command stringByEvaluatingJavaScriptFromString does.

Who can help me on this?

Thanks a lot, DaRolla