The defination of Activity:
An activity is an application component that provides a screen with which users can interact in order to do something , such as dial the phone, send an email, or view a group.
The expend define:
The UI system wil gather the info from the user, just as open or close the system, load one database, connect to internet. All the info will pass to application. And the app will divide them to different class to deal with.In activity, it will only deal with the open adn close actions. it won't deal with the input issues.The Window Class embedded in Activity will deal with it and pass it to View.The first entre to activity will use onCreate method, but the second time, it will call onStart to deal with the problems you left last time.
When you entre one Activity, it will call onCreate, onStart and on Resume. When you left, it will call onPause and onStop. the order will be the same everytime.
There is one ViewRoot. It is not the View or the subclass of View.It responses the connection between WindowManage and WindowManagerService. The WindowManagerService manage all the system windows.
More than one Activities.
Why should we pause the first Activity and then run the Second Activity?
The android should make sure the first Activity will not interfere the second activity. When you listent the music and the phone is coming now, the android should pause the music and to take the phone.
When the view changed from horizantal to vertical, the activity will call onPause, onStop, and onDestory. the activity will start new activity to change the direction of view. So the app will call onCreate, onStart, and onResume.
Initiate one Activity
There are two ways to start one activity:
1.Intent intent = new Intent(this, xxx.class);
startActivity(intent);
2.Intent intent = new Intent();
ComponentName component = new ComponentName(this, xxx.class);
intent.setComponent(component);
startActivity(intent);
The app can also start one Activity from other's app.
In the manifest modify the settings of the activity. add:
<intent-filter>
<action android:name="xxx">
<category android:name="android.intent.category.DEFAULT">
</intent-filter>
and in the buttom to override the method:
Intent intent = new Intent();
intent.setAction("xxx");
startActivity(intent);
Share the data between the activities
Bundle bundle = new Bundle();
bundle.putParceble("name",value);
intent.putExtra(bundle);
The app can never trans the data larger than 0.25 MB. The binder cannot handle it.
Task and its start mode