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:


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

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. Sharing data between users

I'm writing a game that includes an editor for users to create their
own levels.  I'd like players to be able to share the levels they've
created with other players.  I'm trying to figure out the best way of
implementing that, and hoping for any advice on the subject.

One obvious option is to set up a server for sharing levels.  The game
would connect directly to the server to let players share their
creations or download levels created by other players.  This provides
seamless integration and a good user experience, but I'd really prefer
not to use this approach.  For one thing, I don't want the cost and
responsibility of setting up and maintaining the server.  And I would
be taking on a basically unlimited obligation; otherwise, if I decided
to shut down the server a few years from now, the game would suddenly
lose a large part of its value.

Another idea I had is to use the Android Market as the way to
distribute sets of levels.  That way, Google is taking care of running
the server for me.  Clearly there are programs that work this way,
since I've seen lots of themes and expansion packs for particular
applications in the Market.  While this could work, I'm not very happy
with it.  Asking an ordinary user to sign up for a developer account
on the Market and learn how to post files through it is unreasonable,
not to mention they would have to pay $25.

The approach I'm currently leaning toward is allowing levels to be
exported as ordinary files.  People could then just email them to each
other, post them on any website they wanted, etc.  Ideally I would
want to set up a file type association so they could simply open an
email attachment or click a link in the web browser, and my game would
automatically be launched to import it.  I haven't yet looked into
whether that's possible.

Has anyone else done something similar to this?  It seems like a
fairly common sort of problem.  What approach did you decide on?  Do
you have any advice on how to proceed?




2. Bluetooth as nfc


I would like to simulate nfc using bluethooth beetwen 2 android
devices, device a and device b.

- Device a will have start bluetooth when a button is pressed.
- Device b will start bluetooth when my apps start
- Device b will try to connect to device a automatically IF the
distance between the 2 devices is less then 10 cm
- Device a will accept all incoming connections automatically IF there
is some sort of key beeing sent in the request that verifies that the
connection comes from my app.
- Device b will send the information to device a, if the respons is
succefull, device b will close the connection

Does anyone now if this is possible (wich api should I look into/use)?
What I want to do is simulate near field communication.

Thanks in advance!


3. OpenGL ES - Color Picking - Front/Back Buffer

4. Call PHP through URL

5. Android 2.2 Froyo Wifi Hotspot

6. Android Radio streamer Class

7. Where is the View.setStyle() method?