Changes

Jump to: navigation, search

Saving and Restoring Activity State in Android Studio

1 byte removed, 16:47, 18 January 2015
no edit summary
== Restoring the State ==
The saved dynamic state can be restored in those lifecycle methods that are passed the Bundle object as an argument. This leaves the developer with the choice of using either onCreate() or onRestoreInstanceState(). The method to use will depend on the nature of the activity. In instances where state is best restored after the activity’s initialization tasks have been performed, the onRestoreInstanceState() method is generally more suitable. For the purposes of this example we will add code to the onRestoreInstanceState() method to extract the saved state from the Bundle using the “savedText” key. We can then display the text on the EditText1 EditText component using the object’s setText() method:
<pre>

Navigation menu