티스토리 뷰
Android/Task
Task (4.3) - 새로운 task 생성 [FLAG_ACTIVITY_SINGLE_TOP & launchMode="singleTop"]
parkho79 2019. 4. 19. 10:00728x90
새로운 task 생성하기
◼ Manifest
android:launchMode = ["standard" | "singleTop" | "singleTask" | "singleInstance"] |
◼ Intent flag
FLAG_ACTIVITY_SINGLE_TOP |
FLAG_ACTIVITY_NEW_TASK |
FLAG_ACTIVITY_MULTIPLE_TASK |
FLAG_ACTIVITY_SINGLE_TOP
대상 task 는 하나의 instance 만 사용한다.
활성화 될 task 의 top 에 같은 activity 가 존재할 경우, 새로운 activity 를 top 으로 올리지 않고 기존의 top 을 재사용.
(launchMode="singleTop" 과 FLAG_ACTIVITY_SINGLE_TOP 은 동일한 기능이다)
A1 activity 가 A2 activity 를 활성화 하고 A2 는 다시 자신을 활성화 하는 예를 들면 아래와 같다.
◼ FLAG_ACTIVITY_SINGLE_TOP 이 아닌 경우
◼ FLAG_ACTIVITY_SINGLE_TOP
Code
A2 activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = new Intent(getApplication(), A2.class); | |
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); | |
startActivity(intent); |
Manifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.parkho.tasksample"> | |
<application | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme"> | |
<activity | |
android:name=".A1"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
<activity android:name=".A2" /> | |
</application> | |
</manifest> |
ADB
adb shell dumpsys activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities) | |
Display #0 (activities from top to bottom): | |
Stack #1: | |
Task id #136 | |
TaskRecord | |
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.parkho.tasksample/.A1 } | |
Hist #1: ActivityRecord | |
Intent { cmp=com.parkho.tasksample/.A2 } | |
ProcessRecord | |
Hist #0: ActivityRecord | |
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.parkho.tasksample/.A1 } | |
ProcessRecord |
728x90
'Android > Task' 카테고리의 다른 글
Task (4.5) - 새로운 task 생성 [launchMode="singleTask"] (1) | 2019.04.19 |
---|---|
Task (4.4) - 새로운 task 생성 [launchMode="standard"] (0) | 2019.04.19 |
Task (4.2) - 새로운 task 생성 [FLAG_ACTIVITY_MULTIPLE_TASK] (0) | 2019.04.19 |
Task (4.1) - 새로운 task 생성 [FLAG_ACTIVITY_NEW_TASK] (0) | 2019.04.19 |
Task (4) - 새로운 task 생성 (0) | 2019.03.27 |
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- android activity flag
- 리워드앱
- android flag activity
- Android Service
- 앱테크 추천
- 무료채굴
- onContextItemSelected
- registerForContextMenu
- task
- 리워드 어플
- Intent
- 무료 채굴
- WEMIX
- android intent
- mPANDO
- M2E
- 앱테크
- notifyDataSetChanged
- StringUtils
- StartService
- 안드로이드 서비스
- 채굴앱
- 안드로이드 인텐트
- p2e
- onCreateContextMenu
- BroadcastReceiver
- task 생성
- RoomDatabase
- bindservice
- android task
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함