1. Perceptual Cognitive activity
Activity is one of the four components of Android, which is like a container with many Android layouts that can be written directly in the XML layout file referenced by the activity. It can also be shown in the activity in the form of fragment fragments. All in all, activity is like a team, with a diverse group of people who are managed by the team.
Creation of 2.Activity
First we open our development environment, and then create a class, the class name can be random, after the creation of a successful we enter the class, let the class inherit from the activity, let us also in the androidmenifest is the manifest file to register the activity. Such a class is created even if it is done.
Life cycle of 3.Activity usage
When it comes to activity, we all know that activity has its own declaration cycle, and the activity's declaration cycle can be well explained by these seven methods:
1.onCreate ()
2.onStart ()
3.onResume ()
4.onPause ()
5.onStop ()
6.onRetart ()
7.onDestroy ()
4.Activity use of the start mode
When the activity is created, we need to start the activity, which is launchmodule. After the activity has been created, it is stored in a task stack, which is the task stack, the task stack has a feature is that it is detached from the various applications of a thing, not belong to an application. We all know that activity is stored in the task stack, so when we need some activity, we need to go to the task stack to start. There are generally four modes for starting activity:
The first type: standard
The second type: Singletask
The third type: Singletop
Fourth type: SingleInstance
The interaction between 5.Activity
It is not possible to use only one activity between an application, and an application must contain multiple activity, so how does the activity interact?
First, we need a intent object, if there is data interaction, we also need a Bindle object, with the Bindle object to bind the data, let the same Bindle object into the intent object, and finally through the startactivity () method to start the intent object and jump to another activity to achieve interaction between the two activity.
Activity of Android four components