Assembling Your Toolkit for Android App Development
After you know that you’re ready to be an Android developer, grab your computer and get cracking on installing the tools and frameworks necessary to build your first blockbuster application.
Android was created on top of the open source Linux kernel. The Android team chose to use this kernel because it provided proven core features on which to develop the Android operating system. The features of the Linux kernel include (but aren’t limited to)
Security model: The Linux kernel handles security between the application and the system.
Memory management: The kernel handles memory management, leaving you free to develop your app.
Process management: The Linux kernel manages processes well, allocating resources to processes as they need them.
Network stack: The Linux kernel also handles network communication.
Driver model: The goal of Linux is to ensure that the application works. Hardware manufacturers can build their drivers into the Linux build.
Atop the Linux kernel, the Android framework was developed with various features. These features were pulled from numerous open source projects. The output of these projects resulted in these elements:
The Android runtime: The Android runtime is composed of Java core libraries and ART (the Android RunTime). Older versions of Android (4.x and earlier) use the Dalvik runtime.
Open GL (graphics library): This cross-language, cross-platform application program interface (API) is used to produce 2D and 3D computer graphics.
WebKit: This open source web browser engine provides the functionality to display web content and to simplify page loading.
SQLite: This open source relational database engine is designed to be embedded in devices.
Media frameworks: These libraries allow you to play and record audio and video.
Secure Sockets Layer (SSL): These libraries are responsible for Internet security.
See the figure for a list of common Android libraries.
If you’ve read the preceding section, you may say, “Well, that’s all nice and well, but how do these libraries affect me as a developer?” It’s simple: All these open source frameworks are available to you via Android. You don’t have to worry about how Android interacts with SQLite and the surface manager; you use them as tools in your Android tool belt.
The Android team has built on a known set of proven libraries, built in the background, and has given them to you, all exposed through Android interfaces. These interfaces wrap up the various libraries and make them useful to the Android platform and to you as a developer. You benefit from these features because you don’t have to build any of the functionality they provide. Some of these interfaces include
Activity manager: Manages the activity lifecycle.
Telephony manager: Provides access to telephony services as well as to certain subscriber information, such as phone numbers.
View system: Handles the views and layouts that make up your user interface (UI).
Location manager: Finds the device’s geographic location.
Take a look at the libraries that make up the application framework.
From kernel to application, the Android operating system has been developed with proven open source technologies. You, as a developer, can therefore build rich applications that have been fostered in the open source community. See the following figure for a full picture of how the Android application framework stacks up. The Applications section is where your application sits.
Sometimes when you’re developing an Android application, you want to use the same resource as in the core Android system. A good example is an icon for a Settings menu option. By accessing the Android source code, you can browse the various resources and download the resources you need for your project.
Having access to the source code also allows you to dig in and see exactly how Android does what it does. Be aware though that you need to follow the requirements of the license, as well as follow Google’s branding guidelines when borrowing these resources.
The Java programming language is one of the glorious tools that make programming Android a breeze compared with programming for other mobile platforms. Whereas other languages insist that you manage memory, allocate and de-allocate bytes, and then shift bits around like a game of dominoes, the Java runtime helps take care of that for you.
The Java runtime allows you to focus on writing code to solve a business problem by using a clean, understandable programming language (or to build that next cool first-person shooter game you’ve been dreaming of) instead of focusing on the “plumbing” just to get the screens to show up.
You’re expected to understand the basics of the Java programming language before you write your first Android application. If you’re feeling rusty and need a refresher course on Java, you can visit the Java tutorials site.