webview resetting to index.html when changing orientation

by h...@nnes » Sun, 08 Mar 2009 21:07:50 GMT

Sponsored Links
 Hi all,

I'm trying to get some website as a fullscreen webapp going; using

So I have a simple CSS layout based on percental width and height to
fill the entire screen on either portrait and landscape.

All is doing fine apart that when I'm navigating away from my
index.html (lets say to index01.html) and doing a orientation change
by opening or closing the keyboard on the G1, the entire page flips
back to index.html.

No idea what's the reason for this and I couldn't find any ressources.
So any help would be highly appreciated.

Thanks a lot, Best, h...@nnes

This is my simple fullscreen code:

 public void onCreate(Bundle icicle) {

            WebView wv = new WebView(this);
            wv.loadUrl(" http://www.myserver.com/index.html" ;);
            WebViewClient wvc = new WebViewClient();
            wvc.shouldOverrideUrlLoading(wv, " http://www.myserver.com/ 


webview resetting to index.html when changing orientation

by Mark Murphy » Sun, 08 Mar 2009 21:12:38 GMT


This is expected behavior and has little to do with WebView. By default,
when the screen is rotated, your activity is destroyed and restarted. If
you want to maintain state as the rotation occurs, or otherwise control
how rotation behaves, you will need to add some code.

I have a five-post series on AndroidGuys that covers various
possibilities with respect to handling rotation events:

 http://androidguys.com/?s=rotational +forces

Mark Murphy (a Commons Guy)
Android Training in Sweden --  http://www.sotrium.com/training.php 


Sponsored Links

webview resetting to index.html when changing orientation

by h...@nnes » Mon, 09 Mar 2009 00:54:20 GMT

 Hi Mark, You saved me another time, I remember! Thanks you I really
appreciate that.

I'll check your series. Thanks again, Best, Hannes


webview resetting to index.html when changing orientation

by h...@nnes » Mon, 09 Mar 2009 00:57:43 GMT

 Those  http://www.androidguys.com/ are quite troublesome to reach from 
Germany. They're down AGAIN or there is some IP country specific
issue. I also rember that from your last post. Best, Hannes


webview resetting to index.html when changing orientation

by Mark Murphy » Mon, 09 Mar 2009 01:07:27 GMT


It may just be routing or traffic issues to Europe. They're definitely

If you search:

rotational forces android

in Google, you can get to the cached copies, or to some sites that
ripped off the posts.

FWIW, that same material is in my Android book.

Mark Murphy (a Commons Guy)

Android Training on the Ranch! -- Mar 16-20, 2009


Other Threads

1. Quick search box QSB query in FROYO

Hi ,

Earlier in Eclair , I  am having this issue .

Click on QSB and enter few character . Qwerty  keyboard pops up .
Now Press special  key to open Call-log app on emulator . It supress QSB and
open call-log screen .
Now press Back key , this will let user to come to home screen but QSB is
not opened .

In Froyo , I checked , this is fixed ,
QSB comes to state where it was left off .

I was looking for Code Changes done for same , but couldn't figure out till
now . Can any one point me where to look fir this link ??

Thanks :


2. about change the image view alternatively

Hi,in my application i am using the 2 image views.now my question is i want
to display the image views one bye one in run time that means second image
is displayed after some time of first image displayed and first image is
replaced with new image and after some time second image is displayed .in
this way the pprocess is running continously upto my application visible,For
this i want to use

runOnUiThread(*new* Runnable() {} method. Is it suitable for my question
.Give me some sample code .Thanks in advance


Praveena Ankitha


3. Mod: Pre-order HTC Desire + Wildfire untuk member id-android

4. dateformatter

5. Huawei Diam-diam Akan Luncurkan Penantang iPad di Indonesia

6. DeviceMonitor]Failed to start monitoring <Device-number>

7. Paging om @mas drie , help root x10mini