首先,我开始Activity用FLAG_ACTIVITY_NEW_TASK,然后使用命令“亚行外壳dumpsys Activity”,最后我发现在一个任务中的两项活动?
Intent intent = new Intent(this, Main2Activity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
这些Activity是正常的,我没有修改它们?这些是堆栈信息。
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Display #0 (activities from top to bottom):
Stack #1:
mFullscreen=true
mBounds=null
Task id #2493
mFullscreen=true
mBounds=null
mMinWidth=-1
mMinHeight=-1
mLastNonFullscreenBounds=null
* TaskRecord{cb64df8 #2493 A=com.example.flag U=0 StackId=1 sz=2}
userId=0 effectiveUid=u0a63 mCallingUid=2000 mUserSetupComplete=true mCallingPackage=null
affinity=com.example.flag
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.flag/.MainActivity}
realActivity=com.example.flag/.MainActivity
autoRemoveRecents=false isPersistable=true numFullscreen=2 taskType=0 mTaskToReturnTo=1
rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE
Activities=[ActivityRecord{b786d24 u0 com.example.flag/.MainActivity t2493}, ActivityRecord{afe6f61 u0 com.example.flag/.Main2Activity t2493}]
askedCompatMode=false inRecents=true …Run Code Online (Sandbox Code Playgroud) android ×1