I am currently designing a native android application. I am planning to use jQuery Mobile web view as my interface and do all the calculations with java back-end. (still dec
OK, here's an example of interacting with the javascript interface...
Setting the javascript interface in your Activity...
JavascriptInterface javasriptInterface = new JavascriptInterface(this);
webview.addJavascriptInterface(javasriptInterface, "Android");
The inner JavascriptInterface class in your Android Activity...
public class JavascriptInterface {
Context mContext;
JavascriptInterface(Context c) {
mContext = c;
}
public boolean doSomething(String name, String address) {
...
return true;
}
}
EDIT: Your form will have various input fields. Example...
<form name="myForm" ...>
<input type=text name=personName>
<input type=text name=personAddress>
<input type="button" value="Do it" onClick="callDoSomething()" />
</form>
<script type="text/javascript">
function callDoSomething() {
var theName = document.myForm.personName.value;
var theAddress = document.myForm.personAddress.value;
var result = Android.doSomething(theName, theAddress);
}
</script>