Blank Android program basics, manifest and activity brief

Source: Internet
Author: User

Androidmanifest Registering for an event

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

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

Indicates that Backgrounddemo is the main activity of the project, which is the first thing to start the Android program.

Backgrounddemo Program Entry

public class Backgrounddemo extends Activity {    @Override    protected void onCreate (Bundle Savedinstancestate) {        Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.image_main);    }}  

Backgrounddemo inherits from activity. Activity is an active base class provided by the Android system, and all activities in the project must inherit it in order to have an active feature.

The OnCreate () method invokes the Setcontentview () method, which introduces a image_main.xml this layout file for the current activity.

In fact, the Android programming logic and view separation, it is not recommended to write the interface directly in the activity, but in the layout file to write the interface, and then introduced in the activity.

Original address: http://www.cnblogs.com/woider/p/5114666.html

Blank Android program basics, manifest and activity brief

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.