The built-in HelloWorld application project, whose code is generated automatically by the ADT plugin, forms a unique structural framework for the Android project.
Then let me lead you to analyze the various components of an Android program, this time we take a hello,world to do examples, although just a hello,world, but also very perfectly formed, through the analysis of Hello,world directory structure, Let's have a holistic understanding of the Android program.
First, create an Android application project
Start eclipse;
Choose File->new->project ... ;
Select Android Project under Android and click the Next button.
Based on the above directory structure, let's analyze
Second, directory analysis
Let's take a general look at the role of the Android app directory:
1. SRC Directory
The files in this directory hold all Java source code in the Android application and are automatically organized within the user-defined claims package.
Activity is the view part of Android and is responsible for the interface display.
2. Gen Catalog
The files in this directory are automatically generated by ADT, which is the R.java file within the package. The file creates its unique ID in the class for each resource in the project.
You can see from the R file that each resource will have an integer and it corresponds.
3. Android4.4
Different versions of the build may have different dependencies.
The Android4.4 directory holds the jar packages supported by the project.
As a Java project, usually introduces the tool class to be used, that is, the jar package, in Android development, most of the development of the toolkit is encapsulated in a file called Android.jar.
If we expand in eclipse, we can see the packages in J2se, the packages in the Apache project, and the package files of Android itself.
Here we simply browse the Android package file:
Android.app: Provides a high-level program model and provides a basic operating environment
Android.content: Contains a variety of classes for accessing and publishing data on a device
Android.database: Browsing and manipulating databases through content providers
Android.graphics: The underlying graphics library, which contains the canvas, color filters, dots, rectangles, can draw them directly onto the screen.
Android.location: Classes for targeting and related services
Android.media: Provides some classes to manage multiple audio and video media interfaces
Android.net: A class that provides help for network access, more than the usual java.net.* interface
Android.os: Provides system services, message transmission, IPC mechanisms
ANDROID.OPENGL: Tools to provide OpenGL
Android.provider: Provides class access to Android content providers
Android.telephony: Providing API interaction with call-related calls
Android.view: Provides a basic interface framework for the user interface
Android.util: Methods involving tools, such as the operation of a time-date
Android.webkit: Default Browser operator interface
Android.widget: Contains various UI elements (mostly visible) used in the application's screen
4. Assets
Storing project-related resource files
5. Bin
This directory is used to store the generated target files, such as Java binaries, resource packaging files (. AP_ suffixes), executable files (. dex suffixes) for Dalvik virtual machines, and package application files (. apk suffixes).
6. Libs
This directory is used to store third-party jar package files that need to be used.
7. Res
This directory holds the resource files that are used frequently throughout the project, creating a new project in which the following items are automatically created:
(1) drawable the first four directories: three sizes of PNG, 9.png, JPG and other picture resources.
(2) Layout: Storage of the application configuration file, the file type is in XML format. A main.xml file is available when you create a new project.
(3) Values: A resource description file in all XML formats, such as a string (Strings.xml), Color (colors.xml), Style (Styles.xml), Dimensions (Dimens.xml) and Arrays (Arrays.xml), and so on.
File names in the Res directory:
Name the file names in a-Z, 0-9, _ characters.
8. androidmanifest.xml File
In each application root directory there will be a Androidmanifest.xml file, which describes the Android operating system, the program includes the components, the implementation of the functions, can process the data, the resources to request and so on.
Students who have studied Java Web development can use Web application XML to analogy the Androidmanifest.xml file.
The file is the project's system control file, which is the file that is required for each Android project, located at the root of the project.
9. proguard-project.txt File
The Proguard-project.txt file is a script configuration file that confuses the code.
. project.properties file
The Project.Properties file is the configuration information for Android that is used with the current app.
Third Android Android App directory structure parsing