Code example for WebView

Methods: getScalesetPictureListener, getContentHeight, scrollTo

1
			return; 
		} 
		if (state == State.LOADED) {
			Log.i(TAG, "hiding loading view, and scrolling to ratio " + scrollRatio);
			loadingView.setVisibility(View.GONE);
			webView.scrollTo(0, (int) (scrollRatio * webView.getContentHeight() * webView.getScale()));
			state = State.FINISHED;
			webView.setPictureListener(null);
		} else { 
			Log.d(TAG, "onNewPicture called while state = " + state);
		} 
	} 
 
	public Float getScrollRatio() {
		if (state != State.FINISHED) {
			Log.d(TAG, "Not returning any scroll ratio, as webview state is " + state);
			return null; 
		} 
		webView.computeScroll();
		int scrollPosition = webView.getScrollY();
		int height = webView.getContentHeight();