Is there any documentation regarding WebView JavaScript Bridge? I am looking for documentation that describes the capabilities and supported data types for methods defined in "JavascriptInterface".
For example, if I define the following:
public class JavaScriptInterface { public int incrementNumber(int num) { return num + 1; }
If I call this method from JavaScript and run it in the emulator, everything will work fine. If I ran this on my NexusOne, the passed in argument "num" is always "0".
If I changed above:
public class JavaScriptInterface { public int incrementNumber(String num) {
... everything seems to work. So I'm wondering if the arguments to the JavaScriptInterface / method should only be of type String?
Relevant resources: http://developer.android.com/reference/android/webkit/WebView.html http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String) http://code.google.com/apis/maps/articles/android_v3.html
source share