Changes

Saving and Restoring the State of an Android Activity

21 bytes added, 15:22, 10 January 2019
no edit summary
<table border="0" cellspacing="0" width="100%"><tr>
<td width="20%">[[Android Activity State Changes by Example|Previous]]<td align="center">[[Android Studio Development Essentials - Java Edition|Table of Contents]]<td width="20%" align="right">[[Understanding Android Views, View Groupsand Layouts|Next]]</td>
<tr>
<td width="20%">Android Activity State Changes by Example<td align="center"><td width="20%" align="right">Understanding Android Views, View Groups</td>
A key component of saving and restoring dynamic state involves the use of the Android SDK Bundle class, a topic that will also be covered in this chapter.
== Saving Dynamic State State ==
An activity, as we have already learned, is given the opportunity to save dynamic state information via a call from the runtime system to the activity’s implementation of the onSaveInstanceState() method. Passed through as an argument to the method is a reference to a Bundle object into which the method will need to store any dynamic data that needs to be saved. The Bundle object is then stored by the runtime system on behalf of the activity and subsequently passed through as an argument to the activity’s onCreate() and onRestoreInstanceState() methods if and when they are called. The data can then be retrieved from the Bundle object within these methods and used to restore the state of the activity.
<hr>
<table border="0" cellspacing="0" width="100%"><tr>
<td width="20%">[[Android Activity State Changes by Example|Previous]]<td align="center">[[Android Studio Development Essentials - Java Edition|Table of Contents]]<td width="20%" align="right">[[Understanding Android Views, View Groupsand Layouts|Next]]</td>
<tr>
<td width="20%">Android Activity State Changes by Example<td align="center"><td width="20%" align="right">Understanding Android Views, View Groups</td>
</table>