0

On screen rotation, I want to restore data. So I am using onSaveInstanceState method to achieve that. Whenever I restore the bundle in onCreate and print it in Logcat. I am getting additional these two strings as key:

In onCreate:

  if(savedInstanceState!=null){
    for (String key: savedInstanceState.keySet())
     {
            Log.d ("TOTAL BUNDLE READING", key + "KEYS");
            totalfiles.add(new File(key));

     }

    }else{
        Log.d("SAVED FILESELECT","NULL");
    }

Additional those two keys in savedInstanceState are :

           "android:viewHierarchyState"

           "android:support:fragments"
sandesh
  • 390
  • 6
  • 20

1 Answers1

1

Inside of the Bundle of onSavedInstance, under the key of “android:viewHierarchyState”, Android puts another Bundle object. This bundle holds, as its name implies, the View state. Inside the view hierarchy state bundle Android stores a SparseArray under the key “android:views.”

and under the key "android:support:fragments", Android stores fragments.

Read more: http://www.intertech.com/Blog/saving-and-retrieving-android-instance-state-part-1/#ixzz46sDsZSyC

Haresh Chaudhary
  • 4,390
  • 1
  • 34
  • 57