Hi,

This one is easy, but I seem to have a problem using this technique to
save some state.

Basically, the problem I'm having is that neither
onRestoreInstanceState(Bundle) nor onCreate(Bundle) have the bundle
I've previosly saved from onSaveInstanceState(Bundle). In fact,
onRestoreInstanceState(Bundle) never gets called. Here's my
implementation:

@Override
        protected void onSaveInstanceState(Bundle savedInstanceState){
        Log.i("MyActivity.class", "onSaveInstanceState()");
        savedInstanceState.putString("MyString", "This is a test
message.");
        super.onSaveInstanceState(savedInstanceState);
        }

Then I fire up another activity, which has a link to the original one,
where I try to recover the state as follows:

@Override
protected void onCreate(Bundle savedInstanceState) {
                Log.i("MyActivity.class", "onCreate()");
                 if (savedInstanceState != null){
                String myString = savedInstanceState.getString("MyString");
                Log.i("AddActivity.class", myString);
        }
}



@Override
protected void onRestoreInstanceState(Bundle savedInstanceState){
        Log.i("AddActivity.class", "onRestoreInstanceState()");
        super.onSaveInstanceState(savedInstanceState);
        String myString = savedInstanceState.getString("MyString");
        Log.i("AddActivity.class", myString);
}

Like I said the onRestoreInstanceState(Bundle) method doesn't even get
called.

Has anyone faced the same problem? How did you resolve it? Thanks.


--~--~---------~--~----~------------~-------~--~----~
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