I have a webview which has HTML with a link calling Android.closeRegForm() in WebAppInterface i have a method
@JavascriptInterface
public void closeRegForm() {
((MainActivity)mContext).closeRegForm();
}
which must call method closeRegForm on MainActivity, but I am getting this error.
09-10 12:54:50.134: E/Web Console(1171): Uncaught Error: Error calling method on NPObject. at http://example.com/aaa.php:1
when I change this method to
@JavascriptInterface
public void closeRegForm() {
Toast.makeText(mContext, "blabla", Toast.LENGTH_SHORT).show();
}
it shows "blabla" toast. Why I cannot call method on mainactivity?