웹쪽은
<html>
<head>
<script type="text/javascript">
function callGallery(){
if(this.Android) window.KorMart.callGallery("asdad");
}
function callCamera(){
if(this.Android) window.KorMart.callCamera("asdasd");
}
</script>
</head>
<body>
<h1>Picture Upload</h1>
<p>
<button href="#" onclick="callJS('afsd')">CallJs</button>
</p>
<p>
<button href="#" onclick="callGallery()">Gallery Upload</button>
</p>
<p>
<button href="#" onclick="callCamera()">Camera Upload</button>
</p>
<pid="replaceme"></p>
</body>
</html>
이렇게 작성을 하였고
앱에서는
webview.getSettings().setJavaScriptEnabled(true);
webview.addJavascriptInterface(new AndroidBridge(), "KorMart");
private class AndroidBridge {
//갤러리 호출
public void callGallery(String srt) {
Toast.makeText(KorMain.this, srt, Toast.LENGTH_SHORT).show();
selectGallery();
}
//카메라 호출
public void callCamera(String srt) {
Toast.makeText(KorMain.this, srt, Toast.LENGTH_SHORT).show();
selectCamera();
}
}
이렇게 해 주었습니다.
정상적으로 코딩을 한것 같은데 되지를 않네요...
여기서 더 넣어 줘야 할것이 있나요..?;