Changes

Jump to: navigation, search

Handling Android Activity State Changes in Android Studio

15 bytes added, 19:57, 27 October 2016
m
Text replacement - "<table border="0" cellspacing="0">" to "<table border="0" cellspacing="0" width="100%">"
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
A review of the reference documentation for the ActionBarActivity class would reveal that it is itself a subclass of the Activity class. This can be verified within the Android Studio editor using the Hierarchy tool window. With the AndroidSampleActivity.java file loaded into the editor, click on ActionBarActivity in the public class declaration line and press the Ctrl-H keyboard shortcut. The hierarchy tool window will subsequently appear displaying the class hierarchy for the selected class. As illustrated in Figure 11-1, ActionBarActivity is clearly subclassed from the FragmentActivity class which is itself a subclass of the Activity class:
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
[[Image:android_studio_hierarchy_tool_window.png|The Android Studio Class Hierarchy window]]
A key objective of Activity lifecycle management is ensuring that the state of the activity is saved and restored at appropriate times. When talking about state in this context we mean the data that is currently being held within the activity and the appearance of the user interface. The activity might, for example, maintain a data model in memory that needs to be saved to a database, content provider or file. Such state information, because it persists from one invocation of the application to another, is referred to as the persistent state.
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
The appearance of the user interface (such as text entered into a text field but not yet committed to the application’s internal data model) is referred to as the dynamic state, since it is typically only retained during a single invocation of the application (and also referred to as user interface state or instance state).
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
 
<htmlet>ezoicbottom</htmlet>
<hr>
<table border="0" cellspacing="0" width="100%">

Navigation menu