Your option is to expose the method using strings, and then you can use JSONObject or JSONArray to parse the string and use it accordingly.
Here is what I did.
@JavascriptInterface public void passJSON(String array, String jsonObj) throws JSONException { JSONArray myArray = new JSONArray(array); JSONObject myObj = new JSONObject(jsonObj); ... }
where array is ["string1", "string2"] 'and jsonObj is' {attr: 1, attr2: "myName"}'
source share