views:

36

answers:

1

I have seen one other SO question on this and it was not resolved.

I am using LoadData() with application generated html.

I noticed when I add a few blank lines after new text the page scrolls and the text takes a moment to magically appear (no scrolling, it just appears as in a fade-in.).

Watching .getContentHeight() it does not update in the onPageFinshed() event, but it is updated on subsequent additions of text on the page.

I created a timer event to watch getContentHeight. Even after I found getContentHeight had changed and issued a browser.pageDown(true) the page still did on scroll to the bottom.

It seems to be working fine when entering the activity for the first time. My problem only happens with I append a few lines to newInnerHTML.

Additionally the view involved has a header and footer with the browser in the middle. The webView is NOT behind the footer.

Is this a bug, or am I missing something?

TIA, Jim

this code is within the onCreate for the activity.

        final WebView browser = (WebView) findViewById(R.id.webview);
        browser.setWebViewClient(new WebViewClient() {  
            @Override  
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(browser, url);
              //  browser.computeScroll();  //didn't help
                Log.d(TAG,"page getContentHeight: " + browser.getContentHeight());
                Log.d(TAG,"page finished");
                browser.pageDown(true);
            }  
        });

This method is after the onCreate for the activity

private void UpdateMessageDisplay() {

     //loadData fires onPageFinished but without the new data
     browser.loadData("<html><body>" + newInnerHTML + "</body></html>", "text/html", "utf-8");
     //reload() again fires onPageFinished but this time with new data
     browser.reload();

}
A: 

I received a partial answer here, which does get the pageDown(true) to fire.

http://stackoverflow.com/questions/3953791/webview-loaddata-scroll-setting-not-updating-till-clicked

There are still some issues.

Jim