I have an application that makes use of the Android WebView, as well as some JavaScript. When my WebViewClient calls onPageFinished()
, I alert my JavaScript to run
I used this:
Java code in Activity
:
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
...
public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
public int getWinHeight() {
return webView.getHeight();
}
}
JS code:
var winHeight = Android.getWinHeight();