Using sessionStorage in a webview

by hansamann » Wed, 16 Jun 2010 04:55:02 GMT

Sponsored Links
 Hi all,

I am trying to set a flag for the current session in the webview. I
enabled the DOM storage API:


In my HTML page, loaded from the assets directory, I then execute a
small piece of javascript like this:

                        if (!sessionStorage.flag)
                                        //do stuff once per session
                                        sessionStorage.flag = true;
                                //do nothing

Problem: the //do stuff once per session section is always entered, it
seems the flag is set but each orientation change reloads the complete
HTML page and all the session state is completely lost.

I wanted to use the flag to execute a piece of code once, and even if
the user turns the device, (in which the HTML page seems to be
reloaded, for whatever reason), not execute the code again.

Any ideas?
Is this just broken becaus I load the HMTL resource from the local
package, from the assets directory?



Other Threads

1. Problems writing to SD card of physical T-Mobile G1?

In writing a small audio file to the root of the SD card, a T-Mobile
G1 was found to fail. The exact same code works fine on the SDK 1.0 r1
emulator with its emulated SD card. Moreover, that same T-Mobile G1
had no problem writing the audio file to internal flash (in my app
this is an automatic fallback option, activated once writing to SD
card fails).
Have others encountered problems writing to the SD card of a G1? I do
not own or have direct access to this or any other G1 myself, so I
cannot extensively test or provide detailed error messages. Hence my
question whether others have experienced any problems writing to the
SD card of a G1? (The owner of this particular G1 had experienced the
same problem with another app.)



2. acceptable range of ports for DatagramSocket in Android SDK

What is the acceptable range of port numbers which can be passed to
new DatagramSocket(n) in Android SDK?

800 fails (not suprisingly, less than 1024)
1075 succeeds
1999 succeeds
9999 fails
30230 fails

And yes, my manifest requests INTERNET permission :)

Code example below, any clues appreciated...

package com.mese.hello;

import android.os.Bundle;
import android.widget.TextView;

public class MeseHelloAndroid extends Activity {
        protected DatagramSocket s = null;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        TextView tv = new TextView(this);
        try {
            s = new DatagramSocket(1999);
            tv.setText("Mese Says, 'Socket Created.'");
        } catch (SocketException e){
                tv.setText("Mese Says, "+e.toString());
        /* setContentView(R.layout.main); */


3. Tab Appearance

4. How do you associate a file type to open with an application?

5. Content Provider: create/open a file in the overrided "openFile" function

6. Drawing lines in the whole EditText view

7. How do I View the App Store without Android Handset?