Hello,

i want to save important data. If the user rotate the device, the
activity will be recreated (or i have to use the
onConfigurationChanged-method).
I want to save an instance of a class and some Location variables. I
can save all integer values of one Location variable, but this is a
dirty way and i have still the problem with my instance variable.

So i hoped, that the following code would work, but this is not the
case (save the string representation and get the values back with a
cast of the string representation):

public void onSaveInstanceState(Bundle savedInstanceState) {

                super.onSaveInstanceState(savedInstanceState);
                savedInstanceState.putString("sh", sh.toString());
                savedInstanceState.putString("last", last.toString());
                ......
        }

public void getSaveInstanceState(Bundle savedInstanceState)
{
        if (savedInstanceState!=null)
        {
               ........
               sh = (SaveHelper)savedInstanceState.get("sh");
               last = (Location)savedInstanceState.get("last");
               .......
        }
}

Or must I use the onRetainNonConfigurationInstance()-function?? But
there i only get one return value?!?

And if I use the onConfigurationChanged-function and
android:configChanges="keyboardHidden|orientation" in my
AndroidManifest.xml, the app will recreate after other configuration
changes, too....

So what is the best way for me??


Thanks,
Stefan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to