This series is the Reading Notes for reading "Pro android4". It also includes the preparation of online reading materials and my personal experiences.
Because smartphones introduce AP (application processor), Android is a personal computer in a sense. It has a complete architecture of desktop computers and uses Linux-based OS stack to manage devices, memory, and processes. Android Java library covers multiple aspects such as telephone, video, connection, graphics, and UI programming. Android SDK supports almost all j2se, excluding the AWT and swing parts of the UI, which is replaced by the android UI framework.
Android optimizes the Dalvik Vm for the limited memory, processor speed, and battery capacity of handheld devices. The Dalvik VM encapsulates the generated Java calss file into one or more Dalvik executable files (. Dex ). The final code executed on Android is not a java byte code, but a. Dex file. That is, you cannot directly run Java byte code and need to convert it to a. Dex file.
Android architecture view of application developers
Android software stack from the perspective of application developers.
Linuxkernel handles device drivers, resource access, power management, and other operating systems. (Wei: I think this is not accurate, because there are changes to Android, especially Hal, and the Linux community does not accept the contribution of Android .)
On the kernel, the C/C ++ library, such as OpenGL, WebKit, FreeType (Font Processing), SSL, libc, sqlit, and Meida. Bionic is a BSD-based glibc for Android. The libc version improved for the embedded system is about half of the original size. The media library is a packetvideo-based opencore for recording and playing audio and video formats. The surface Manager processes the system display and supports 2D and 3D. Android uses skia as the 2D graphics library and OpenGL
Es to support 3D.
Most application frameworks access core libraries through DalvikVM. The Dalvik VM runs multiple VM instances. When a Java application accesses the core library, each application obtains its own VM instance. (Wiki: The Dalvik virtual machine can have multiple instances. Each Android Application uses a self-owned Dalvik Virtual Machine for execution, so that the system can be optimized during program execution. The Dalvik virtual machine does not execute Java bytecode, but executes a file called. dex format)
The Android Java library is the application framework layer in the Android standard architecture diagram, including telephone, resource, location, UI, content provider, and Package Manager. Developers develop applications on these Apis. Some applications have been integrated into the system, such as Home, contacts, phones, and browsers.
Develop applications using Android SDK
Android simulator.Android simulators support 90% application development, but there are limits on USB connections, photography and video capture, battery simulation, Bluetooth, headphones, Wi-Fi, NFC and OpenGL ES. Android uses QEMU technology and is an open-source "processor Simulator" that allows one OS simulator to run on another OS. (Wei: The MeeGo simulator also uses QEMU and KVM. The biggest problem is that KVM virtualization requires hardware support, that is, the CPU must support VT, but not all the desktops can support CPUs, especially portable CPUs)
Android UI.Android UI can use an XML script file to customize the UI application window and use the ID to obtain control information in Java code. The screen or window is called activity in Android. View is the basic UI unit of Android and can be combined into a view group. View is familiar with the concepts of cavase, painting, and user interaction. In Android
3.0 introduce the new UI concept fragment to process multiple panes on a large screen (tablet), while fragment provides the abstraction of the pane. A key concept of the Android framework is the lifecycle management of the activity window.
Basic components.The UI framework of Android introduces the new concept intent. Intent is a mechanism to wake up components within and between processes. As a component, a code with a clear life cycle, such as activity and service, is a component that is called by events. To call a component, intent has window message, action, publish and order mode, and inter-process communication.
Android provides intuitive support for resources, including string, bitmaps, and XML-basedview definitions. The automatically generated file R. Java is the description of the resource. Each automatically generated ID corresponds to the element in the XML file or the entire XML file. Developers can use these XML definitions using these IDs. This is very helpful for processing Local Language Environments and device size adaptation.
Another new concept is content provider, which is the abstraction of data sources.
Advanced UI concepts.Android introduces many advanced UI concepts. Including layout and menu in XML format, asynchronous Dialog (Note: it is not the synchronous Modal Dialog mode of MFC in Windows), support for animation, including frame-by-frame animation, gradient mode of visual conversion (amplification, reduction, displacement, rotation, angle ). Android uses OpenGL
Es supports 3D graphics. OpenGL ES is a C library. Android follows the APIS defined for open es in j2s. For details, refer to proandroid 3.
In homeui. Android supports live floder (a small application layer plug-in. It is represented by the icons on the desktop. By clicking these icons, a list box is displayed, and the data information is displayed in the list box. You can view the data in the Active Directory without opening the application. [1]). However
Supports widgets, and the role of livefloder is gradually reduced. Android also provides integrated search to search for device and network information and provides searchapi.
In addition, custom gestures, sensor control, dynamic configuration (such as Layout Based on the Landscape), actionbar, drag-and-drop (Android 4.0 can be used for phone and pad).
The above Metropolis is described in detail in the chapter after "Pro Android 4.
Others.In addition, there are Service components, Media components, and Telephony components. For more information, see the package description in the Android SDK reference. Android uses the AndroidManifest. xml file of the application to reflect these concepts, including activities definition, service and contentprovider registration, and license declaration.
Currently, Andriod has over 50 packages and thousands of classes. Besides andriod. * Besides, java. *, javax. *, and others, such as org. apache. http, org. json, org.w3c.com, org. xml. sax, org. xml. sax. ext, org. xml. sax. helpers, org. xmlpull. v1, and org. xmlpull. namespace package starting with v1.sax2.
Benefits from the Android open source code
Android source code tutorials in http://source.android.com. Git is available at https://android.googlesource.com/. currently, it does not support online reading. For online reading, visit http://www.oschina.net/code/javase/android-4.0.1. Or more complete, easier to read, accessible http://www.grepcode.com/search? Query = google + android & entity = project.
Related links:
My Android development articles