Upload
chae-chul
View
93
Download
2
Embed Size (px)
DESCRIPTION
Android activity & Task
Citation preview
Index
1. Activity / Process Lifecycle
2. “launchMode” in AndroidManifest.xml
3. Tasks and Back Stack
Process Lifecycle
• Foreground: At the top of the screen, interacting with user
• Visible: Visible to the user, but not in the foreground
• Background: Not visible, paused
• Empty: hosting no activities or Service, BroadcastReceiver
android:launchModeAndroidManifest.xml
<activity
android:name=".activity.SMSReadActivity"
android:label="@string/setting_sms_read_title"
android:launchMode="singleTop" >
</activity>
android:launchMode
• “standard”
• “singleTop”
• “singleTask”
• “singleInstance”
can be instantiated multiple times.
can be held only one instance of activity.
Tasks and BackStack
Intent intent = new Intent(this, NewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Tasks and BackStack
• FLAG_ACTIVITY_SINGLE_TOP
• FLAG_ACTIVITY_NO_HISTORY
• FLAG_ACTIVITY_CLEAR_TOP
• FLAG_ACTIVITY_REORDER_TO_FRONT