Is the WebView getContentHeight() broken in 1.5/1.6?

by authoreyes » Thu, 22 Apr 2010 02:10:46 GMT


Sponsored Links
 All -

Urgent issue (and I see other people mentioned it with no resolution),
but how can I force getContentHeight() in the WebView to return an
accurate reading of the currently loaded content?

I have a WebView that needs to occasionally trim content (must display
on one page/no scrollbars).

I have it check the contentHeight onDraw, and it is too much, it trims
it, reloads it, and checks again.

Some times it works, but almost always not.  It always seems to report
the initial content height, as those it caches a value and won't
replace it (which looking at the WebView code, is what it seems to
do).  I can't find a way through the api though, to force it to
remeasure the html content height onDemand.

I am tearing my hair out here...Please anyone have any ideas?

--



Is the WebView getContentHeight() broken in 1.5/1.6?

by Maps.Huge.Info (Maps API Guru) » Thu, 22 Apr 2010 05:24:39 GMT


 You might try adding a bogus parameter to the end of the URL, such as
a random number or the time, like this:

url.htm?x=12345

That will most likely not bollix up the page and make the cache save
that as a unique page.

-John Coryat

"Radar Now!"

"What Zip Code?"

--


Sponsored Links


Is the WebView getContentHeight() broken in 1.5/1.6?

by authoreyes » Thu, 22 Apr 2010 05:32:57 GMT


 That is an interesting thought.....

Although I am using the loadData method with a string each
time....There is no actual url to speak of...I have tried clearing
cache/view/etc....

It's so odd...The view loads the right data, but the height reports
the original (even though the size is wildly different between loads)
for a few changes, then something causes it to re-eval, etc...

It's not consistent at all, and really annoying...if I can't depend on
this, I am not sure where to go with this current architecture....

On Apr 21, 4:24pm, "Maps.Huge.Info (Maps API Guru)"


>



Is the WebView getContentHeight() broken in 1.5/1.6?

by Maps.Huge.Info (Maps API Guru) » Thu, 22 Apr 2010 06:27:37 GMT


 You could also try switching to a method that saves the page to the
device and loads it as a URL instead of the direct method that you're
using now, that might get around the issue. Have you tried to test it
with a 2.0+ emulator? Still a problem?

-John Coryat

"Radar Now!"

"What Zip Code?"

--



Other Threads

1. Random ClassCastException in Stress testing

Hello All,

I have a ListActivity with the custom ListAdapter. On clicking a
button in rowlayout of list item I get a custom dialog with a couple
of buttons. Since the Custom dialog carries same buttons and should
not be created again and again even if the user clicks on several
buttons of list items in succession, so I have maintained only one
object of the custom dialog in my custom ListAdapter. But, during
stress testing I am getting the following log:


ERROR/AndroidRuntime(7759): Uncaught handler: thread main exiting due
to uncaught exception
ERROR/AndroidRuntime(7759): java.lang.ClassCastException:
android.widget.LinearLayout
ERROR/AndroidRuntime(7759):     at appln.testlist.TestListAdapter
$1.onClick(TestListAdapter.java:206)
ERROR/AndroidRuntime(7759):     at
android.view.View.performClick(View.java:2364)
ERROR/AndroidRuntime(7759):     at
android.view.View.onTouchEvent(View.java:4198)
ERROR/AndroidRuntime(7759):     at
android.view.View.dispatchTouchEvent(View.java:3728)
ERROR/AndroidRuntime(7759):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:852)
ERROR/AndroidRuntime(7759):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
ERROR/AndroidRuntime(7759):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
ERROR/AndroidRuntime(7759):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
ERROR/AndroidRuntime(7759):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
ERROR/AndroidRuntime(7759):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
ERROR/AndroidRuntime(7759):     at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
1107)
ERROR/AndroidRuntime(7759):     at
android.app.Dialog.dispatchTouchEvent(Dialog.java:643)
ERROR/AndroidRuntime(7759):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
ERROR/AndroidRuntime(7759):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
ERROR/AndroidRuntime(7759):     at
android.os.Handler.dispatchMessage(Handler.java:99)
ERROR/AndroidRuntime(7759):     at android.os.Looper.loop(Looper.java:
123)
ERROR/AndroidRuntime(7759):     at
android.app.ActivityThread.main(ActivityThread.java:4363)
ERROR/AndroidRuntime(7759):     at
java.lang.reflect.Method.invokeNative(Native Method)
ERROR/AndroidRuntime(7759):     at
java.lang.reflect.Method.invoke(Method.java:521)
ERROR/AndroidRuntime(7759):     at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
ERROR/AndroidRuntime(7759):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
ERROR/AndroidRuntime(7759):     at
dalvik.system.NativeStart.main(Native Method)





I am not getting it always, or lets say it appears in very random
manner so, I have no clue about finding the solution or spoting the
problem area. Any help or suggestion regarding this is quite welcome!


Thanks and Regards,
Ankita

-- 

2. How to make screen shoots for an android device?

Hello,

Can anyone tell me please how can i make screen shorts with an android
device.
I have to test an application,and to make screen shorts on it.
and i need an screen short tool that will run in the background,
while i am running my application.
Is it possible.
Please give me an advice, a link where i can find this kind of the
application

I would appreciate any help
Thanks
Lidia

-- 

3. OpenGL - 3D rotation from a 2D input

4. somebody stole our app and resale it on the market.

5. Background Service to recode different activities and upload on server

6. Problem porting Android Froyo

7. Can you have RadioButtons in a RadioGroup in a TableRow?