The Android Application consists of one or more activities. every activity is not closely related, because we can call other activities in our own programs, especially those generated outside of our own code, such as text messages or called activities provided by Android.
Intent call = new intent (intent. action_call, Uri. parse ("Tel:" + phonenumber );
Startactivity (CALL );
Intent SMS = new intent (intent. action_sendto, Uri. parse ("smsto:" + phonenumber );
Startactivity (SMS );
From this point of view, Android applications are actually assembled by multiple activities in a certain order, but some data is transmitted in the background during the assembly process, makes the activities better connected.
I mean, in Android applications, there is no main function like C ++ or Java as the entry point of the application. android applications provide entry-level activities rather than entry-level functions.
When creating an Android Application in eclipse, an activity will be created by default. This activity is actually an entry activity. Where can I define it as an activity? The androidmanifest. xml file defines the activity contained in the entire android application. The default generated activity is defined:
<Activity Android: Name = ". activity01" Android: Label = "@ string/app_name">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
Android. intent. action. main indicates that its activity is the entry point of the entire application. android. intent. category. launcher refers to assigning the activityg to the loader class, that is, marking the activity as the activity that will be automatically loaded and started, so that the activity will be loaded when the program starts. this is the reference Reference ---- "the launcher category says that this entry point shoshould be listed in the application launcher. "It means something different from what I understand. however, this activity is to be loaded by the application.
We can compare the logs output by the console in eclipse. initially, I set <category Android: Name = "android. intent. category. launcher "/> This line is commented out in the original XML file. the console reports the error "No launcher activity found! ", In fact, the" lifecycle_test "app cannot be found in the Application List on the virtual device at this time, and it cannot be loaded. remove the comments and restore them to the initial state. Then, when you start the application, you can see "No launcher activity found! "The error message is missing. On the screen of the virtual device, you can see that the" lifecycle_test "app has been successfully run.
[09:29:10-lifecycle_test] --------------------------------
[09:29:10-lifecycle_test] Android launch!
[09:29:10-lifecycle_test] ADB is running normally.
[09:29:10-lifecycle_test] No launcher activity found!
[09:29:10-lifecycle_test] The launch will only sync the application package on the device!
[09:29:10-lifecycle_test] semi-ming sync
[5554 09:29:10-lifecycle_test] Automatic Target mode: using existing emulator 'emulator-2.2 'running compatible avd' myavd _ 100'
[09:29:15-lifecycle_test] application already deployed. No need to reinstall.
[09:29:15-lifecycle_test] \ lifecycle_test \ bin \ lifecycle_test.apk installed on Device
[09:29:15-lifecycle_test] Done!
[09:30:47-lifecycle_test] --------------------------------
[09:30:47-lifecycle_test] Android launch!
[09:30:47-lifecycle_test] ADB is running normally.
[09:30:47-lifecycle_test] discovery Ming test. activity. Leipei. activity01 activity launch
[5554 09:30:47-lifecycle_test] Automatic Target mode: using existing emulator 'emulator-2.2 'running compatible avd' myavd _ 100'
[5554 09:30:47-lifecycle_test] uploading lifecycle_test.apk onto device 'emulator-100'
[09:30:47-lifecycle_test] installing lifecycle_test.apk...
[09:30:54-lifecycle_test] success!
[09:30:55-lifecycle_test] Starting activity test. activity. Leipei. activity01 on device emulator-5554
[09:30:57-lifecycle_test] activitymanager: Starting: intent {act = android. intent. action. main cat = [android. intent. category. launcher] CMP = test. activity. leipei /. activity01}