SecondActivity
唯一的布局很简单,在ContentView
它的onCreate()
方法中设置:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
}
而且activity_second.xml
是:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondActivity" />
但是当我dumpsys
用来转储最重要的活动时,它会Fragment
在输出中列出一个未知数(“ReportFragment”):
$ adb shell dumpsys activity top
TASK xxx.lifecycleapplication id=4
ACTIVITY xxx.lifecycleapplication/.SecondActivity 538274ac pid=1519
Local Activity 5368915c State:
mResumed=true mStopped=false mFinished=false
mLoadersStarted=true
mChangingConfigurations=false
mCurrentConfig={1.0 310mcc270mnc en_US sw384dp w384dp h567dp nrml port finger qwerty/v/v dpad/v s.5}
Active Fragments in 536891f0:
#0: ReportFragment{5369f99c #0 androidx.lifecycle.LifecycleDispatcher.report_fragment_tag}
mFragmentId=#0 mContainerId=#0 mTag=androidx.lifecycle.LifecycleDispatcher.report_fragment_tag
mState=5 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0
mAdded=true mRemoving=false mResumed=true mFromLayout=false mInLayout=false
mHidden=false mDetached=false mMenuVisible=true mHasMenu=false
mRetainInstance=false mRetaining=false mUserVisibleHint=true
mFragmentManager=FragmentManager{536891f0 in SecondActivity{5368915c}}
mActivity=xxx.lifecycleapplication.SecondActivity@5368915c
Added Fragments:
#0: ReportFragment{5369f99c #0 androidx.lifecycle.LifecycleDispatcher.report_fragment_tag}
FragmentManager misc state:
mCurState=5 mStateSaved=false mDestroyed=false
Local FragmentActivity 5368915c State:
mCreated=true mResumed=true mStopped=false FragmentManager misc state:
mHost=androidx.fragment.app.FragmentActivity$HostCallbacks@5368b814
mContainer=androidx.fragment.app.FragmentActivity$HostCallbacks@5368b814
mCurState=4 mStateSaved=false mStopped=false mDestroyed=false
为什么输出显示ReportFragment
在“Active Fragments”和“Added Fragments”中,而我没有使用任何Fragment
?