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