Preface : This is the first chapter of the first line of code learned, before using Eclipse to create an Android project is automatically generated in the Mainactivity.java file and the layout folder under the Activity_main.xml layout file, today the automatic generation of these files are removed, manually created these two files, so write down the essay to record the deepening impression, and this is the first time since the application blog published something, is to take notes as a habit to keep under Go, OK, here it is ....
1. All the steps to create the project are the same, only until the last tick of the Create Activity is removed, then click Finish
2. After the project has been created to see what the file, we see the src and Layout folder is not a file, then we will proceed to create the file
3. First, we create the package com.example.helloworld2under the src folder, create the package, create the Mainactivity.java class in the package, and under the Layout folder , create the first_layout.xml , as follows:
4. Write down the following code in the Mainactivity.java file, first, the class inherits from the activity class and then implements the OnCreate () method, which is called by the system when the activity is created. Is the beginning of an activity life cycle)
5. Add an activity to the Androidmanifest.xml with the following code:
6. Finally, just add a line of code to load the layout just OK
7. Finally, run as is running.
Android New project manually add layout layouts