I am creating a javascript api for my application and I want to use namespaces in my javascript code. However, I cannot get it to work and cannot find any information about the problem.
Desired Functionality:
HTML:
<script> Android.typeOne.methodName(); Android.typeTwo.methodName(); </script>
Java Code:
webView.addJavascriptInterface(new TypeOneInterface(context), "Android.typeOne"); webView.addJavascriptInterface(new TypeTwoInterface(context), "Android.typeTwo");
However, this never works, if I delete .typeOne and have: Android.methodName then it works fine.
source share