[Lushengduan] "Android-based N-detailed HelloWorld series" 00, description and HelloWorld implementation

Source: Internet
Author: User

Presumably everyone to HelloWorld is not unfamiliar, called "Programming Primer classic"! We know that HelloWorld is one of the simplest small programs, however, to run this simple applet, the Android system framework can do a lot of things, which involves the AMS, PMS, WMS and other system services, system services to work together, methodically complete the application installation, Operation and so on, there are many articles on the internet to analyze the Android framework, most of it is also very exciting, very thorough, but, indeed, these materials are somewhat old, so, want to surround HelloWorld, based on Android N (Android 7.0/ 7.1) Organize the knowledge of Android framework, one is the knowledge has a backup, convenient for their own future view, and the second is also hope that the article can help some friends, less detours.

Well, don't say more, first realize this HelloWorld bar.

Define Androidmanifest.xml

<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.testapplication"Android:versioncode= "1"Android:versionname= "1.0" >    <USES-SDKandroid:minsdkversion= "+"android:targetsdkversion= "+" />    <ApplicationAndroid:allowbackup= "true"Android:icon= "@drawable/ic_launcher"Android:label= "@string/app_name"Android:theme= "@style/apptheme" >        <ActivityAndroid:name= "Com.example.testapplication.MainActivity"Android:label= "@string/app_name" >            <Intent-filter>                <ActionAndroid:name= "Android.intent.action.MAIN" />                <categoryAndroid:name= "Android.intent.category.LAUNCHER" />            </Intent-filter>        </Activity>    </Application></Manifest>

Writing Mainactivity.java

 Package com.example.testapplication; Import android.app.Activity; Import Android.os.Bundle;  Public class extends Activity {    @Override    protectedvoid  onCreate (Bundle Savedinstancestate) {        super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main);    }}

Layout layouts Activity_main.xml

<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:id= "@+id/container"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical" >    <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Hello world!" /></LinearLayout>

Very simple, HelloWorld is finished,:

[Lushengduan] "Android-based N-detailed HelloWorld series" 00, description and HelloWorld implementation

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.