Creating HelloWorld in Eclipse+adt is very simple, just follow the navigation next. This article focuses not on how to create, but on the understanding of HelloWorld project files. Need friends can refer to the next
The HelloWorld directory structure is:
src: The logical code that holds the application, and the code is written manually.
Gen: Store resource code, where the code is generated automatically
Assets: storage mp3 and other video resources
bin: generated executable binaries directory
Libs: Reference to the library, which is consistent with the contents of the bin/dexedlibs.
res: Resource file. When adding resources to this directory, it is automatically recorded by Gen/r.java and automatically recorded in the R.java.
androidmanifest.xml: The total configuration item for the project, documenting the various global configurations used in the application
ic_launcher-web.png: This is for the Google Play market to use the display icon, it needs a 512x512 high resolution icon.
Proguard-project.txt
project.properties
These two files were used to confuse code that was made to protect the Android project. Official documents in:http://developer.android.com/tools/help/proguard.html
Look at one of the following:
src
a folder in which user code resides, at least one activity. The concept of activity is the interface, which is equivalent to the Windows Form in C #.
See at least one OnCreate function, which is called when rendering the interface, which is rendered using R.layout.activity_main, which corresponds to the GEN/R
Following the Activity_main equals sign is the resource descriptor.
This is a good place to look at the R class.
Gen/r.java
Each of the classes in R corresponds to one resource in the res,
For example, layout corresponds to Res/layout
drawable corresponds to RES/DRAWABLE-XXDPI
So the r.layout.activity_main corresponding to the above is actually res/layout/activity_main.xml. This separates the interface from the logic, which is the concept of a typical MVC pattern layering.
Gen/buildconfig.java
It contains the global debug switch, and you can use this switch to do log and debug operations.
But how do you modify this? Gen below the file should not be manually modified, specific can refer to: http://drovik.com/html/5701262218.html
bin
This directory is the directory of the generated files, and you can see that it puts the APK package, androidmainifest.xml all generate a copy in the folder.
Bin/class.dex
Java-compiled Java bytecode files, equivalent to the Java. class file. But because Android uses Dalvik virtual machines and standard Java virtual machines that are incompatible, Dex and class are different.
Now there are tools on the web that can be used by Dex to decompile the Android code. Like this: http://code.google.com/p/android-apkdb/
bin/helloworld.apk
This is the installation package for the application (application package file). A APK file contains compiled code files (. dex files), File resources (RES), assets, certificates (certificates), and manifest files (manifest file). APK is based on the zip file format.
Bin/resources.ap_
This is a collection of all the resource files, actually a zip format. We can change its suffix name, decompression can be seen inside the structure is mainfest,res and so on.
Bin/dexedlibs
corresponding jar packages referenced in the Libs
Res
This directory is all the resource files.
res/drawable-xdpi: Here are the resources for the different resolutions
res/layout: Store The layout resources, the OnCreate method in src loads the Activity_main resources
res/menu: menu for mobile phone
res/values: used to store variables, parameters, etc.
res/values-xx: different parameter settings for different devices or different Android versions