Go deep into Android [2]-Architecture and learning

Source: Internet
Author: User

Android architecture and features

When the call came out, I was half-blind. -- Xing

Although expensive is the second generation of rich, if Android doesn't have anything to enclose, it won't take 70 steps. In the competition of a wide range of mobile phone platforms, at best, it will make a few push-ups to beat a bucket of soy sauce, then it is far away. After all, it depends on technology. The architecture is stolen from the SDK documentation from an Android platform Architecture Diagram , As shown above. In the bottom layer of the entire architecture Linux Kernel A port on the mobile platform hides hardware, network, and other related details, providing a relatively pure unified interface for the upper layer. Unless you want to migrate Android devices to different devices, most common developers do not have to worry about it. Google has always stressed that the underlying implementation of Android is abnormal Nb, which is highly portable and has no efforts to study it. On the top layer, there are some Core and extended Class Libraries They are all native C ++ implementations. At this layer, you can see many familiar faces, such as SQLite, WebKit, and OpenGL. The power and contribution of open source can be seen. If this layer class library needs to be called by upper-layer functions, it must pass JNI To export the corresponding interface function, otherwise it can only be played within the hierarchy. At this level, there are also Program Service Runtime . Dalvik virtual machine is the Java Virtual Machine of Android. The reason why we do not use the Virtual Machine of j2_on the one hand is that the design of j2_on is optimized for low-end machines, while Dalvik is optimized for high-end machines, provides better performance. On the other hand, from a commercial point of view, we must bypass the j2's Virtual Machine to completely free Android. We do not need to consider the license issue if we want to open the source. Finally, Java came into existence. First Framework Layer It contains all the SDK class libraries used for development. In addition, there are some class libraries and implementations of undisclosed interfaces, which are the embodiment of the core mechanism of the entire Android platform. At the top Application Layer Some Applications of the system and all applications developed by a third party are at this level. The difference between the two may be entangled, that is, the system applications will use some hidden classes, while third-party applications, it is always based on what the SDK provides. In general, Android development is based on the SDK, which uses Java to write applications. However, since ndk is available, there has been a small change in writing. The emergence of ndk means that the content at the top application layer can be directly exposed to the underlying layer through the framework layer deployed in Java, or directly talked to the self-developed C ++ library, of course, JNI interfaces must be included in these libraries. People said that android can use C ++ to develop applications. However, such a statement is not accurate enough. Pure C ++ applications cannot be accepted. In Android, a large number of core mechanisms are deployed at the framework layer. They are implemented in Java, such as control library and activity scheduling. Therefore, without the interface or scheduling, it is more appropriate to use C ++ as a class library, otherwise everything will be messy. Features are based on this architecture, and many Android designs seem interesting. The design of the entire SDK and core mechanism is neat and elegant, which is the first thing Android gives. To illustrate this point, it is necessary to find a negative textbook. Symbian has no suspense to assume this Wei 'an role. Writing a Symbian program is like playing a guessing game. Even if you are a veteran of Symbian, you may still be helpless when you need a strange feature in Symbian. You often need to guess and search for it again and again. Which kind of odd tricks do I need here? Should I think about some events or use a mysterious UID to find a specific application, and so on. For Android applications, it is like a simulated examination question for the college entrance examination. The questions look different. The answer mode is clear, and the answer mode is a hundred. Listen to a system event and check the SDK. Access the data of an application to see if it provides the content provider. All things are played by a routine. As long as you understand the routine, you can also understand the unfamiliar card. People say that martial arts experts should all have no choice but to do anything, and a good application framework should also be very lightweight and accessible. The most elegant aspect of the android framework is the introduction of the mash-up idea. The so-called mash-up refers to building blocks for writing applications. when the results are to be achieved, it is good for dongjia to work together on the scene. There are two key points. One is Modular And the other is Dynamic . The so-called modularization means that the functions of an application should be clearly blocked into functional points with clear boundaries. Each functional point is like a black box, and the interaction mode is described by pre-defined rules; dynamic means that these independent modules can be connected according to the Requirement Description during operation to accomplish a larger function. Android has done a great job in both aspects. From the point of constructing an application with the mash-up mechanism to look at the design of some of the core functions of other android systems, it looks like there are rules to follow. For example, why are we going to privatize files, why are we going to host processes, and so on (of course, we can also see different effects from other perspectives, different perspectives, and naturally different visions ...). Android is also very good in terms of UI mechanism. It uses a resource file in XML format to describe all interface-related content. Resource files are not new things, and the XML format is also old-fashioned, but what is valuable is that android is richer and more thorough, basically putting all the interface-related logic from Code It is actually several times more powerful than the four resource files in Symbian. Getting started with Android

Without a long journey or even a thousand miles. -- Persuasion

It is difficult to start with everything. To start Android development, the most important thing is to first stabilize the horse step and clarify the routine, so there will be more things in the future. Open your arms and embrace Android. Maybe you can do the following first. In the development environment, the developer's official website of Android Developers is relentlessly shut down. But it doesn't matter. If you slam here, you can also achieve the same goal (shit, has been using a proxy, just tried it and found it was also blocked. If not, so we can only go over the wall ...). If your journey goes smoothly, you can SDK/index.html Find the installation instructions and configure the android Development Environment ( [Note] : In the future, if you want to give the link on the developer page, you will give a relative path like SDK/index.html. You can add the official website address in front of it, or the local SDK Doc address is pieced together into a complete path. In a shield-running dynasty, we can only use this method to ensure better use... ). Before 2.0, you have to go to the next brand-new SDK for each version update, and then follow the instructions to carefully modify the eclipse settings step by step, which is very troublesome. After 2.0, this mode has been improved. You will first go to a plug-in similar to the downloader, through which you can manage and upgrade the SDK, which not only simplifies the entire upgrade mode, it also allows you to better migrate between different SDK versions to benefit the country and the people. Eclipse + ADT (Android Development Tool) is a licensed Android development environment. You can develop on Windows, Linux, and Mac. Compared with the Symbian development environment, ADT is particularly powerful. It encapsulates a bunch of excellent command line tools provided by the SDK on the UI, provides a graphical interface (command line control is certainly equally happy. For details, see: Guide/developing/tools/index.html ). With the ADT, you can use the running and management simulators to debug, filter and view logs, Browse File Information on the simulators, and simulate dial-up, SMS, and other mobile phone events. I know that many people are used to buying books such as XXX 21-day proficiency when learning a new platform for development. But in fact, the best entry-level learning material is SDK documentation . Only by being a platform can you better understand the secrets and priorities of the platform, so that you can better take the right medicine to get rid of the disease. In the android SDK, Guide/index.html Is a teaching document from a simple perspective, Reference/packages.html Is a standard API document. My Opinion on teaching documents is that I can read it all or even multiple times without a single word, at least to be able to understand Android and encounter problems, I can quickly remember where I can find it and read it deeply. In terms of API documentation, Android does a good job. Basically, each class and each interface has a standard and detailed description. In some particularly important classes, there is also a lot of learning content, which is not like Symbian, there are too many eunuch classes, and there is only one bare function, which is not described in one line. The entire document structure is organized according to the Java package. The Java package naming structure and readability are very strong and convenient to find. Many people are in conflict with the SDK documentation. I think there are two reasons. First, the SDK documentation lacks literature and is difficult to swallow. Android is poor in this aspect. Although it is not elegant, it is quite suitable for reading. Another reason is the language. The SDK documentation is mostly in English. Sometimes there are Chinese characters like msdn, and it remains at the level of Machine Translation, making reading quite uncomfortable. I searched for some Chinese documents for SDK translation, such as here. Although it was written based on the 1.5 R1 SDK, it was a little outdated, but it was still very helpful to translate it. As a helper, it was also a good document, we would like to pay tribute to the audience members who wish for the welfare of the people. In addition to reading, writing is also an indispensable exercise in the entry stage. Similarly, in the SDK, Android provides a set of tutorials and samples of some columns. For details, see: Resources/index.html . Tutorials is simple, Hello World It just teaches you how to create an android project in eclipse with the help of ADT. In contrast, Hello views It is more complicated. It shows how several standard Android layout styles are built. In many cases, you need to extend the required UI under these styles. Hello Localization It teaches you how to use resources. After you finish this, you can learn about how to kill Android resources ~. The final ending is a more complete Notepad tutorial It demonstrates many core Android mechanisms, such as intent-based activity integration and activity lifecycle. Take this tutorial step. Welcome to the door of Android. Of course, after tutorials is completed, it is just a glimpse of Android. The SDK also provides a series of samples. You can select a suitable sample for compiling, running, and learning based on your needs. However, no matter what you do, you must be familiar with it. API demos . In this sample, the API usage of the key Android functions is displayed in a centralized manner. You can familiarize yourself with this sample and find out what you need to do before. The source code is here, and many readers must be very disdainful. The so-called introduction to learning is just a conversion around the SDK. In fact, the same is true. The content in the SDK is really important. I just hope that some beginners will pay attention to it through some brief introductions. Of course, every SDK platform has nothing to worry about. However, Android has another rare and valuable expert Source code . From the android source Website: http://source.android.com/, you can refer to the source code of the entire platform. It is a bitter hope that everyone will go down and put a source code on the machine, even if you do not need to modify and compile it, putting it on the machine as an encyclopedia is far better than any android teaching book. This series Article A lot of content will be learned from the source code. For most developers, the source code has learning value, mainly in the source code Frameworks And Packages Directory. The former includes some implementations of the platform's core. For example, if you need to customize a control, you may be able to go to the implementation of a system control to see how it is implemented. The latter includes some system application implementations. For example, if you want to be a player, you may first refer to the specific implementation of the system. Even if this is not the most colorful, it is at least the most standard, and its value cannot be underestimated. You can also treat it as Code library So that you won't use a class, grep a hand, maybe you can get the most beautiful sample. Of course, if you are confused about some system mechanisms or have bugs that do not know where the source is, you can follow the source code. Such a good thing is not something that every platform can enjoy. Other forums are actually very important resources for development and learning. After all, all the information is dead, and only people are living, so they can solve the problem as much as possible according to local conditions. However, the standard official forum has been put on Google group and has been easily defended. The Chinese forum is not very good and active. On the one hand, it is because the development status of Android is not very great, and on the other hand, it is because Android development is much less skillful than Symbian, there are not so many questions. Maybe you can go to a traditional forum like csdn or a special forum like EOE. Sometimes, you can still get some help. There is really no recommendation for books. Search on Douban. You can see that the current books are basically concentrated on the SDK usage level, and few of them are thoroughly parsed, it is very in-depth. When using the SDK, it is enough to read the SDK documentation. If you don't catch up with E, it would be nice to buy one or two Chinese books with poor comments. Furthermore, you may be able to read some empirical documents and search for some code on Google Code. For example, the SDK document contains a set of Empirical Documents: Resources/articles/index.html . Finally, more things need to be summarized in engineering and thinking. I believe that good code will attract a diligent and considerate person.

Related Article

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.