. Net coding agricultural Android-system architecture and Basic Concepts

Source: Internet
Author: User

At this point, you should have completed the following preparations:

1. Install JDK

2. Install the SDK (and update the relevant version in the Manager)

3. Related IDE (such as eclipse)

4. After installing ADT

5. Install AVD (if you simulate a real machine)

The setup of the preliminary environment is basically complete, and the HelloWorld can be run according to the online tutorial to ensure that the process can go through.

The so-called Summit, a small view of the mountains. When I learn new things, I always give an overview of them from the system or global perspective so that I can grasp them from a higher perspective, in addition, you will have a systematic understanding of the next learning, which will make later learning more organized and targeted.

 

I.Next we will introduce the basic system architecture of Android.

In the outermost application layer that is responsible for direct interaction with users, applications that are normally visible and downloadable, such as browsers, games, and music players.

Next is the application framework layer, which is often called during application development, such as ActivityManager and ViewSystem.

Next, we get to the JVM layer of the running mechanism. You can see that it not only contains a Runtime, but also has some related class libraries.

The lowest layer is a Linux-based kernel that includes some hardware drivers and is mainly responsible for interacting with the hardware. For example, you can call a camera in your application, wi-Fi interfaces are very convenient.

 

 

II.Engineering organization and structure

Next, right-click a new AndroidApplication project. If it cannot be found, the following others in the new option is shown:

All the way to next, after the creation is as follows:

III.Let's get to know what each folder is doing.

Src: stores your source code, such as the. java file, which can be understood as the class library. cs file in.

Gen: do not change the system-generated items. Expand it as follows: it is similar to the registered global ID (which will be introduced later ).

GoogleApis: Google interfaces in some sdks.

AndroidPrivateLibarares: Some Android class libraries.

AndroidDependencies: Some Dependent libraries of Android.

Assets: stores "large" resource files in your project, such as videos, videos, and media, the so-called "big" is only because there is a resource folder in the Android project. res mainly stores "small" resources such as fonts, texts, and colors.

Bin: this is not necessary.

Libs: similar to dll reference in.

Res: Mainly stores "small" resources such as fonts, texts, and colors. Expand as follows:

Layout and values are mainly used (others may be used in large quantities, but they are still exploring)

Layout: used to store layout files

Values: used to store text, color, and kv values (note that in Android development, to maintain project flexibility and avoid hard coding, it is recommended that you store the kv value to a file and directly reference it in the place where it is used, which is why the values folder is needed ).

AndroidManifest. xml: this file is very important. It is used to save the configuration list of the entire program, such as the project name, version number, start activity, and permission description.

 

 

III.After understanding the engineering structure, let's take a look at several basic concepts.

Because I have learned java in school before (although I have forgotten about it), I still have some basic knowledge about some basic syntaxes and usage, if you do not know anything about java, I suggest you take an hour or two to look at basic syntaxes, such as how to inherit and implement interfaces. I believe that as a c # programmer, it may take 10 minutes for you to get it done, because you will find it is incredibly similar to c!

Now, we can really get started!

As a beginner who is mysterious about mobile application development, I just want to know how to start and how it is actually implemented and displayed on a mobile phone.

Open activity_main.xml in the layout folder, and you can see it. Is it familiar? (controls + layout + code)

This is the startup page of the program. Similar to the main method, this is the portal. Of course, you can also set other portal pages by yourself.

 

Concepts:

1. Activity: This is the most common concept. You can think of it as the screen of the current Activity, that is, a page displayed on the mobile phone, Lenovo webpage.

This is the lifecycle of the Activity.

The visible life cycle of an Activity is OnStart () until OnStop () ends (content may not be visible, but related resources will be retained)

The foreground life cycle of the Activity starts from OnStart () until OnStop () ends (interacts with the user at the beginning)

2. Package name: the "package name" in java is similar to the namespace in c #. A "package" is a dll reference file. However, I think eclipse is doing a good job, that is, when you use a method or class, you don't need to import it at the top. It seems that it will automatically help you, And vs seems to have to work on it.

In java, we need to ensure that the package name is unique. Therefore, we generally use the reversed name of the Company domain name, such as com. letchoice. HelloWorld.

 

 

3. Several shortcut keys and related settings

1. format the code: ctrl + shift + F (preferred for code cleaner)

2. Some problems may occur when formatting the xml document. Set the following parameters:

3. for those who are familiar with vs, you may have adapted to the intelligent prompt function of vs. In eclipse, this may not be good at vs. You only need to input ". "Before you can see the prompt. If you want it to intelligently prompt and complete the code at any time like in vs, you can use window-> preference to open the settings panel as follows:

Change "." to "abcdefghijklmnopqrstuvwxyz." to save it.

4. Xml Code prompts and complete function settings are as follows:

Change the identifier to "<=: abcdefghigklmnopqrstuvwxyz.

 

I am still groping for Android development and java usage. It is inevitable that omissions and errors may occur. I hope you can criticize and correct them more and share them with you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.