WebView.getScale() is deprecated (but still usable)
The recommended way to get scale for webview is to use WebViewClient.onScaleChanged() http://developer.android.com/reference/android/webkit/WebViewClient.html#onScaleChanged(android.webkit.WebView, float, float)
I've added corresponding handler in my custom webview:
public class CustomWebView extends WebView {
public CustomWebView(Context context) {
super(context);
setWebViewClient(new WebViewClient() {
@Override
public void onScaleChanged(WebView view, float oldScale, float newScale) {
super.onScaleChanged(view, oldScale, newScale);
currentScale = newScale
}
});
}
And now the problem: the method not invoked (at least on my nexus 7) if I'm zoom in/zoom out using pinch, so it works good only if I use zoom controls button.