Java-android Study (third day)

Source: Internet
Author: User

Android Program Entry point

On the first day, "⑤, program entry point." "The problem with the entry point of the program is mentioned, but more general,

Here, say it again:

 <application        android:allowbackup= "true"          android:icon= "@drawable/ic_launcher"         android: Label= "@string/app_name"         android:theme= "@android: style/ Theme.Black.NoTitleBar.Fullscreen ">        <activity             android:name= ". Mainactivity "            android:screenorientation=" Portrait "            android:label=" @string/app_name " >            <intent-filter>                 <action android:name= " Android.intent.action.MAIN "/&GT;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&Nbsp;       <category android:name= "Android.intent.category.LAUNCHER"/>             </intent-filter>         </activity>    </application>

All activity programs are registered in the Androidmanifest.xml file, so the file is the core profile for the entire Android project.

The android:icon= "@drawable/ic_launcher" configured in the <application> node represents the reference drawable (drawable-hdpi, drawable-ldpi, DRAWABLE-MDPI three folders Import) the icon of the resource configuration, the name of the introduction icon is Ic_launcher;

The android:label= "@string/app_name" configured in the <application> node indicates that the label name of this application is read from the Strings.xml file and the content is app_name corresponding content; Of course, you can also change the title of the activity .

Activity is an active form, and a project application can contain multiple activities.

<intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android:name= "Android Oid.intent.category.LAUNCHER "/></intent-filter>

The activity contains the above tag, which means that the program is the activity that launches the tag by default:

The method is specified as follows:

①, Android:name= ". Mainactivity "Specifies the. java file in SRC;

②, in the corresponding. java file

protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);

}

where Setcontentview (r.layout.activity_main);, specify the layout XML in Res-layout.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////

Page layout

Core

Java-android Study (third day)

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.