Start learning the details of Android development today, starting with the most basic concepts and operations.
First look at the directory structure of the Android project.
This is a test project that I randomly built, and we focus on a few things:
1. SRC directory: The directory where Java source code is stored, a package is built inside, and there are 4 Java source files in the package (each of which inherits from activity). Because Java requirements are stricter, the class name is required to match the file name.
2, Gen (Generated java files) directory: Automatically generated Java source files directory, is automatically generated by the tool, generally do not need to modify their own. There is a R.java file, which is a final class (cannot be inherited), and defines a series of static variables that the programmer can refer directly to in the program code.
3, Assets Directory: The directory of file resources, unlike the Res directory, the resources copied to this folder will not automatically generate the ID in R.java, if you need to use the file here, you need to specify the path.
4. Bin directory: As in C #, store the final compiled executable program, as well as some necessary files. For example, there is a Classes.dex file, which is the running environment of the Android virtual machine (packaged files), and the apk file is the one we can install on the Android system.
5. Libs directory: Store a directory referencing some jar packages. The jar file is actually a ZIP package (you can directly modify the suffix named Zip, and then unzip it to see the class file), similar to the DLL file in C # (there are multiple class files in the jar, and the DLL is a file but it can encapsulate multiple assemblies).
6. Res directory: The directory where some resources are stored. It is more important to have layout directory and values directory. The former store the layout file (a acvitity can correspond to multiple layout files), some buttons, text boxes, drop-down boxes, checkboxes, and so on these elements can be placed inside, can be understood as a container to hold these elements. The values directory is the information that holds some key-value pairs, which can be automatically generated in the final class string in the R.java file so that they are referenced directly by R.string.id in the program. Other, such as drawable is the directory where the image is stored, menu is the place to set menu items.
7. androidmanifest.xml file: This is an Android manifest file, all the activity needs to be registered in this area to access, you can also set the Add permissions and the Android SDK version number and so on.
Here is a brief introduction to the Android project directory structure and their respective functions, first a comprehensive understanding of the basic.
Android Development series of Android project directory structure