Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the program architectures in Android

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what are the program architectures in Android". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the program architectures in Android"?

Android Program Architecture 1. Src/ Source Code (source) directory

The src directory contains the various code files needed in an Android application. These files are wrapped in a subdirectory of the corresponding package. (as in the BMI example in this chapter, the subdirectory refers to / src/com/demo/android/bmi/)

The key programs in the src directory are:

1. Bmi.java the file name of eucalyptus will change depending on the value of the "Create Activity" field you fill in in the create a new eucalyptus screen. This is the main program block in the new program eucalyptus. We spend most of our time developing Android programs dealing with Android in the src directory.

Gen/ automatically generated (Generate) directory

All automatically generated eucalyptus files are stored in the gen directory.

The most critical program in the gen directory is the R.java file.

1. The R.java file is generated automatically. The ADT plug-in will automatically update and modify the 'R.java' file according to the XML description files, images and other resources you put into the res directory. All Android programs will have this file under the name R.java. You don't need it at all and should avoid manually modifying the R.java file.

The automatically generated "R" category in R.java is like a dictionary, containing various resources such as user interfaces, images, strings, and corresponding numbers (id). Many times in Android applications, you need to call resources through class R. The compiler also looks at this list of resources at compile time, and resources that are not used will not be compiled, saving unnecessary space for mobile applications.

Android Program Architecture 2. S / Resource (Resource) directory

The "res" directory holds the resource files used in all programs. "Resource file eucalyptus" refers to the eucalyptus in the data file, or the XML description file that is converted into part of the program at compile time. Android handles resources in different subdirectories under the "res" directory in different ways. So when we write a program, we can figure out what can be placed in each directory.

Android Program Architecture 3. Layout/ layout (layout) directory

The "layout" directory contains all interface description files that use the XML format. The XML interface profile in "layout" is like the HTML file used to write a web page, which is used to describe the layout and interface elements used on the screen. The content of the XML interface description file can be the entire screen or only part of the interface (such as the interface element used to generate the dialog box).

Although you can create a user interface directly through Java, it is relatively easier to create a user interface through a XML profile, has a clearer framework, and makes it easier to figure out problems in future maintenance. To use these interface elements, you should call them through the "R" category automatically generated in the "R.java" file.

Android program architecture 4. Values/ parameter value (value) directory

The "values" directory contains all the parameter value description files that use the XML format, where you can add additional resources such as strings (commonly used), color, style, and so on. It is also called through the "R" category when it is used.

Android feature list

Android program architecture 5. AndroidManifest.xml

"AndroidManifest.xml" is a list of functions of the Android program, where the application lists the functions provided by the project. When the application is opened, it provides information such as the content provider (ContentProvider), the type of data processed, the actual running class, cross-application information, and so on. Here you can specify the services (such as phone features, network features, GPS functions, etc.) that your application will use. When you add a new page behavior category (Activity), you also need to register the new Activity category here before you can call it smoothly.

At this point, I believe you have a deeper understanding of "what is the program architecture in Android?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report