The androidmanifest.xml in manifests.
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.chenshuai.test" > <Application Android:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_name"Android:supportsrtl= "true"Android:theme= "@style/apptheme" > <!--who started before <activity android:name= ". Axtivity2 "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/> <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name= ". Mainactivity "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/&G T <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity& Gt </application></manifest>
New Layoutactivity.xml in Layout
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" Match_parent " android:layout_height=" Match_parent " Android:weightsum= "1" > <!-- Match parent window match_parent Package Contents wrap_content- <textclock android:layout_width= "Wrap_content" android:layout_height = "Wrap_content" android:text= "Good People" /></linearlayout>
Layout in mainactivity
PackageCom.hanqi.text3;Importandroid.app.Activity;ImportAndroid.os.Bundle;//inherited activity. Public classMainactivityextendsActivity {@Override//overwrite OnCreate () overriding the parent class protected voidonCreate (Bundle savedinstancestate) {//Super Parent class//The method that called the parent class Super. OnCreate (savedinstancestate); //to set the association of Java Code and layout files//ID value via r fileSetcontentview (R.layout.activity_main); }}
New Activity2 in Java
Packagecom.example.chenshuai.test;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.util.Log;/*** Created by Chenshuai on 2016/3/16.*/ Public classAxtivity2extendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (r.layout.layoutactivity); System.out.println ("This is the first activity I run."); //Output LogLOG.D ("Test", "Log output Information"); LOG.W ("Test", "Log output Information");//Warning BlueLOG.E ("Test", "Log output Information");//Eror RedLOG.I ("Test", "Log output Information"); LOG.V ("Test", "Log output Information"); }}
Android--activity Practice