Android does not have a main function, how to find the program to execute the portal? And a description of how the activity's main life cycle is

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.

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, 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:

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 put this activi The tyg is attributed to the loader class, which marks the activity as an activity that automatically loads and starts, so that the activity is loaded first when the program starts. The reference manual says so----"The LAUNCHER category says that This 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.

Description of the activity's main life cycle method:
       OnCreate (Bundle savedinstancestate): Called when an activity is created.  Set in this method, it also provides access to any previously stored state in the form of bundles!  OnStart (): Called when activity becomes visible to the user on the screen. Onresume (): Called when activity starts interacting with the user (whether it is starting or restarting an activity, the method is always called).
       OnPause (): Activity is paused or recalled CPU and other resources when called, the method is used to save the active state, but also to protect the site, press stack bar! OnStop (): Called when activity is stopped and turned into an invisible phase and subsequent life-cycle events. Onrestart (): Called when activity is restarted. The activity is still in the stack, not the start of a new activity .

Android does not have a main function, how to find the program to execute the portal? And a description of how the activity's main life cycle is

Related Article

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.