If you do not use Eclipse, if you use other ides, or use text editing tools and command line tools), The Eclipse plug-in will not help you. The Android plug-in Eclipse environment is tightly integrated with a set of Android SDK tools, such as simulators, aapt, adb, ddms, and other documented tools.) Therefore, it can also be encapsulated using other tools, such as creating a file with 'ant. The Android SDK contains a Python script named "activityCreateor. py", which can be used to create all source code and original directories for your project.
You can also generate a build. xml file compatible with Ant. This allows you to create your project from the command line or integrate it with your IDE. For example, you can create a HelloAndroid project similar to the one we just created through Eclipse, you can use this command.
The most important thing is to notice the internal class named "layout" and its member domain "main ". The Eclipse plug-in detects that you have added a new XML layout file and the re-generated R. java file. After you have added a new resource to your project.
You will find that R. java is automatically updated. The last thing to do is to use the new XML file of your UI to modify your HelloAndroid source code instead of purely using the code. The following is what your new class looks like. As you can see, the source code becomes very simple.
The Eclipse plug-in creates these XML files for you. In the above example, we briefly show them. In the package browser, expand the res/layout folder, edit the main. xml file, replace it with the preceding text, and save the changes. Open the file "R. java" in the source code folder of the package browser and you will see the following code:
- public final class R {
-
- public static final class attr {
-
- };
-
- public static final class drawable {
-
- public static final int icon=0x7f020000;
-
- };
-
- public static final class layout {
-
- public static final int main=0x7f030000;
-
- };
-
- public static final class string {
-
- public static final int app_name=0x7f040000;
-
- };
-
- };
To create this project, run the 'ant' command first. When the command is successfully executed, a file named Android SDK is generated under the bin/folder. This .apk file contains eleven Android packages, which can be installed in your simulator using the adb tool. For more information about using these tools, please read the previous reference documents.