HI All,

My application generates an HTML file which needs to be displayed to
the user . For this purpose I'm using the loadData() API provided by
Webview. This HTML file is updated every 2 secs & the same is loaded
again using loadData() to display the updated values. On reloading the
file the Webview starts displaying again from the top of the file
causing the user to always scroll down to the location where he
previously was. This causes a very bad user experience.

To overcome this issue an alternative that I could think of was to
split the file to multiple files that can exactly fit in the the
screen. For this I need to find the height of the HTML content that
can loaded in a web view.

>From the WebView documentation I found that an API getContentHeight()
is provided for this purpose. Although this method returns me 0 on the
first attempt. On subsequent attempt it gives me the height of the
page that was previously loaded.

I'm not able to figure out how I can use getContentHeight() api to
give the height of the HTML content that is currently loaded.

The code snippet that I'm using  is as follows
mWebView = (WebView) findViewById(R.id.ftsWebView);
mHTMLData = new String(readfromHTMLFile());
mWebView.loadData(mHTMLData, mimeType, encoding);
int contentHeight = mWebView.getContentHeight();

Thanks in advance for your advice.

Regards
Abraham




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to