Android Question Webview extras try to get X, Y from an image but : Signature issue (Solved !!)

fsikkerm

Member
Licensed User
Longtime User
Hi All,

I want users to select a position from an image in a web page using webview and webview extras
Page loads fine and I can zoom etc..

This is the error : java.lang.Exception: Sub wloc signature does not match expected signature.

in my code :

Sub Activity_Create(FirstTime As Boolean)
WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
etc..


This is the sub

Sub wloc(mode As Boolean, px As String,py As String )
Log("Web view click " & px & ":" & py )
End Sub




Some source of the webpage :
<script language="JavaScript" type="text/JavaScript">
var posx;var posy;
function capmouse(e){
// captures the mouse position
posx = 0; posy = 0;
if (!e){var e = window.event;}
if (e.pageX || e.pageY){
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY){
posx = e.clientX;
posy = e.clientY;
}
}
function showP(){

B4A.CallSub('wloc', false, posx , posy )
}
</script>
</head>

<body onmousemove="capmouse(event)">
<img src="26.png" onclick="showP()">

</body>

Hope someone can help here..
 

fsikkerm

Member
Licensed User
Longtime User
Sorry Fixed it!!! Found a sample

Sub wloc(mode As Boolean, px As String,py As String )
Log("Web view click " & px & ":" & py )
End Sub
 
Upvote 0
Top