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. Android merek lokal akan bertambah lagi

Setelah IMO (vendor ponsel lokal) yang pertama kali meluncurkan ponsel
Android, selanjutnya HT Mobile akan meluncurkan pula ponsel Android. HT
Mobile adalah merek lokal yang baru 1 tahun berdiri (tepat hari ini
dirayakan) tertarik pula untuk membuat ponsel berbasis Android. Menurut
Nuramin, GM HT Mobile, pihaknya tertarik karena Android banyak mengusung
fitur hiburan. Dan, pihaknya akan serius membuat ponsel Android. Sebelumnya
HT Mobile terkenal dengan ponsel "online" seharga Rp500ribuan, tapi untuk
ponsel android bukan faktor harga murah yang bakal ditonjolkan melainkan
"isi jeroannya" misalnya, prosesor, versi OS, dll. Selain  HT Mobile, Nexian
sebagai kampiun vendor ponsel lokal kabarnya juga sudah membuat protipe
ponsel Androidnya. Belum ada keterangan lebih rinci mengenai hal itu.
Bagaimana pendapat warga milis id.android terhadap merek lokal?

"Indonesian Android Community [id-android]" 

2. GPS without gps signal

Hi All
Is possible that can using the signal GPS without signal the telephony
active. I need save the gps location in the sqllite when the telephony is



3. ADT Eclipse Plugin won't let me put in a Target

4. Error: An SDK Target must be specified.

5. Android Video Spec.

6. How to add an image to my background drawable?

7. Setting android.R.styleable.Theme_textColorDim for my android application