Standard singleTop singleTask singleInstance

First two activities: Activity01 activity02

Simple interface:

The simple pattern under Standard is the normal life cycle, which I won’t go into here

Activity01 mode is standard:

1.Activity02 mode is singleTop:

01 – > 02 – > 02

      

The reuse runs onPause() onNewIntent() and onResume().

2.Activity02’s mode is singleTask:

01 – > 02 – > 02

OnPause () onNewIntent() and onResume() are used for reuse as well as singleTop.

02 > > 02 01

OnNewIntent (),onStart(),onResume()

Activity02’s mode is singleInstance:

02 > > 02 01

When you reuse it, you call three functions. onNewIntent(), onStart(), onResume()

To sum up, whether singleTop singleTask singleInstance,

OnPause () onNewIntent() and onResume()

If it is multiplexed: onNewIntent(), onStart(), onResume()

4. Pay particular attention to:

Actiity: singleTop singleTask singleInstance: actiity: singleTop singleTask singleInstance: singleTop singleTask

/ @override protected void onNewIntent(Intent Intent) {super.onnewintent (Intent Intent); setIntent(intent); initData(); initView(); } private void initData() {Intent Intent = getIntent(); mCourseID = intent.getStringExtra(COURSE_ID); }Copy the code