JavaScriptInterface 를 이용한 테스트를 진행 중입니다.
1. JSP 에서 Android Toast 호출 (정상)
2. JSP 에서 Android AlertDialog 호출 (정상)
2.1 Android AlertDialog 에서 ok button click 시 JSP 의 javascript "function testFunc ()" 호출 실패
- "Uncaught ReferenceError: testFunc is not defined" 에러 발생
@JavascriptInterface
public void showAlertDialog(String title, String msg){
Builder alert = new AlertDialog.Builder(context);
alert.setTitle(title)
.setMessage(msg)
.setPositiveButton("okay", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
webview.loadUrl("javascript:newGroupOkay()");
}
}).show();
}
JSP
function testFunc() {
console.log('called testFunc from android ');
}