Life cycle: from birth to death
7 methods and 3 loops for the activity life cycle
Called when OnCreate () is created
Onrestart () is not visible when the call is seen
OnStart () Called when the user is visible
Onresume () Call when user can interact
OnPause () Call when user is not interactive
OnStop () Call when user is not visible
OnDestroy () call when destroying
Start-and-exit loops
Activity start OnCreate ()--OnStart ()--Onresume ()
Activity Exit OnPause ()--onStop ()--OnDestroy ()
Visible and Invisible loops
Activity not visible onPause ()--onStop ()
Activity re-visible onrestart ()--OnStart ()--Onresume ()
Loss of focus and the cycle of gain
Activity loses focus onPause ()
Activity gets Focus Onresume ()
-----------------------------------------
Intent Bridge to jump between components
Intent is divided into the following two categories:
Explicit Intent (Explicit intent)
Explicitly specify the activity to jump to
Ambiguous intent (implicit intent)
There is no direct assignment to jump to which activity filters the activity to jump through a series of filtering criteria
1.1 Clear intent jump to activity under the same package
Intent.setclass ()
1.2 Clear intent jump to activity under different packages
Intent.setclassname ("Package name of the application", "activity package name. Activity class name");
The special case is that the package name of the activity is the same as the package name of the application, and the second parameter can be abbreviated as ". Activity class Name "
1.3 Clear intent jump to activity under different applications
Intent.setclassname ("Package name of the application", "activity package name. Activity class name");
At the same time, the jump activity needs to add Action=main filter
An ambiguous intent.
There are 7 filter conditions that need to be set:
ComponentName---Component name usage is basically similar to Setclassname ()
Action--Actions
Category-Extra action
Data--(format as URI object)
Extra--Additional data
Flag--logo
Type--Data type (MIME) multimedia format data types (text, picture, audio, video)
2.1 Ambiguous intent jump to activity under the same package
The jump activity needs to be set
Intent.setaction ("Com.second");
The activity that is being jumped at the same time needs to set the intent filter in Androidmanifest.xml:
<intent-filter >
<action android:name= "Com.second"/>---arguments with set consistent action () when jumping
<category android:name= "Android.intent.category.DEFAULT"/>--cannot be omitted
</intent-filter>
2.2 Ambiguous intent jump to different packages under the Activity method ibid.
2.3 Ambiguous Intent jump to Activiy method in different applications ibid.
Android life cycle with intent notes