"Go" entry for Android apps

Source: Internet
Author: User

Android apps, consisting of one or more activity. Each activity is not closely related, because we can invoke other activity in our own program, especially the activity generated outside of our own code, For example, Android provides SMS or call activity.

    New Intent (Intent.action_call,uri.parse ("Tel:" +PhoneNumber);     StartActivity (call);              New Intent (Intent.action_sendto,uri.parse ("Smsto:" +PhoneNumber);     

From this point of view, the Android application is actually organized by a number of activity in a certain order, but in the process of assembling, the background to pass some data, so that the activity can be a better link up.
Pulled so much, in fact I mean still want to say, Android application, and there is no such as C + + and Java has the main function to act as the portal of the application. Android apps provide entry activity, not entry functions.
When you create an Android application in Eclipse, an activity is created by default. The activity is actually an entry activity. Where is the activity defined? The Androidmanifest.xml file defines the activity that the entire Android app contains. The default generated activity is defined as:

    <ActivityAndroid:name= ". Activity01"Android:label= "@string/app_name">             <Intent-filter>                 <ActionAndroid:name= "Android.intent.action.MAIN" />                 <categoryAndroid:name= "Android.intent.category.LAUNCHER" />             </Intent-filter>         </Activity> 

The Android.intent.action.MAIN in the action node indicates that the activity in which it resides is the entry point for the entire application. and the category of Android.intent.category.LAUNCHER means to return this Activityg The loader class, which marks the activity as an activity that automatically loads and starts, loads the activity as soon as the program starts. The reference manual says so----"The LAUNCHER category says that Entry point should is listed in the Application Launcher. There is a discrepancy between the meaning and my understanding. But that means the activity is being loaded by the application.
We can look at the logs from the console output in Eclipse. Initially, I put <category android:name= "Android.intent.category.LAUNCHER"/> This line has been commented out in the original XML file. You can see the console will error "No Launcher activity found!", in fact, in the virtual device in the list of applications cannot find the "Lifecycle_test" this app, and also can't run, It doesn't load at all. After you remove the comment, revert to the initial state, and then start the app and see "No Launcher activity found!" This part of the error message is not available, and the virtual device on the screen, you can see the "Lifecycle_test" the app has been successfully run.


[2011-08-11 09:29:10-lifecycle_test]------------------------------
[2011-08-11 09:29:10-lifecycle_test] Android launch!
[2011-08-11 09:29:10-lifecycle_test] adb is running normally.
[2011-08-11 09:29:10-lifecycle_test] No Launcher activity found!
[2011-08-11 09:29:10-lifecycle_test] The launch would only sync the application package on the device!
[2011-08-11 09:29:10-lifecycle_test] Performing sync
[2011-08-11 09:29:10-lifecycle_test] Automatic Target mode:using existing emulator ' emulator-5554 ' running compatible AVD ' myavd_2.2 '
[2011-08-11 09:29:15-lifecycle_test] Application already deployed. No need to reinstall.
[2011-08-11 09:29:15-lifecycle_test] \lifecycle_test\bin\lifecycle_test.apk installed on device
[2011-08-11 09:29:15-lifecycle_test] done!
[2011-08-11 09:30:47-lifecycle_test]------------------------------
[2011-08-11 09:30:47-lifecycle_test] Android launch!
[2011-08-11 09:30:47-lifecycle_test] adb is running normally.
[2011-08-11 09:30:47-lifecycle_test] Performing TEST.ACTIVITY.LEIPEI.ACTIVITY01 activity launch
[2011-08-11 09:30:47-lifecycle_test] Automatic Target mode:using existing emulator ' emulator-5554 ' running compatible AVD ' myavd_2.2 '
[2011-08-11 09:30:47-lifecycle_test] Uploading lifecycle_test.apk onto device ' emulator-5554 '
[2011-08-11 09:30:47-lifecycle_test] Installing lifecycle_test.apk ...
[2011-08-11 09:30:54-lifecycle_test] success!
[2011-08-11 09:30:55-lifecycle_test] Starting activity test.activity.leipei.activity01 on device emulator-5554
[2011-08-11 09:30:57-lifecycle_test] ActivityManager:Starting:Intent {act=android.intent.action.main Cat=[android.intent.category.launcher] cmp= TEST.ACTIVITY.LEIPEI/.ACTIVITY01}

"Go" entry for Android apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.