Reputation: 2367
I want to get the content height of each webpage one by one. But I am not getting that. If I am loading page separately then I am able to get the height of each page. But if I tried to get content height of webpage continuously then I failed.
Here is my code-
StringBuffer content;
String temp;
for(i=tempstart_index;i<=tempend_index;i++)
{
Log.i("value of i",i+1+"");
content+=decrypted(i);
temp1=decrypted(i);
// TODO Auto-generated method stub
webview.setWebViewClient(new WebClient());
{
@Override
public void onPageFinished(WebView view, String url)
{
webview.loadUrl("javascript:window.HTMLOUT.getContentHeight(document.getElementsByTagName('html')[0].scrollHeight);");
int initialpageheight=webview.getContentHeight();
if(initialpageheight>0)
{
webheight=initialpageheight;
//Toast.makeText(getApplicationContext(), ""+initialpageheight, Toast.LENGTH_LONG).show();
Log.i("page finish","" +webheight);
initialpage=webheight;
if(pagenumber>0)
{
webview.scrollTo(0, webheight);
}
}
}});
webview.loadDataWithBaseURL("file:///android_asset/KH_Brown_Fixed_Layout/",temp1,
"text/html", "utf-8",null);
}
return content;
}
then I am displaying the all merged page as a one page after merging string-
//here reflowable() reading html and merging them and after merging returning it.
String ds=reflowable();
webview.loadDataWithBaseURL("file:///android_asset/KH_Brown_Fixed_Layout/", ds, "text/html", "utf-8", null);
Upvotes: 3
Views: 1858
Reputation: 22768
In JavaScript you can get the height of the page on a webkit browser with:
window.innerHeight
As to what else you're attempting in there, I have no clue, but that'll give you the height in your Android browser.
Upvotes: 3