Skip to Main Content
Programming Android, 2nd Edition
book

Programming Android, 2nd Edition

by Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamura
September 2012
Intermediate to advanced content levelIntermediate to advanced
566 pages
16h 52m
English
O'Reilly Media, Inc.
Content preview from Programming Android, 2nd Edition

Chapter 3. The Ingredients of an Android Application

Based on the foundation laid in the preceding chapter for writing robust Java code, this chapter introduces the major high-level concepts involved in programming for the Android platform.

Traditional Programming Models Compared to Android

Operating systems traditionally use a single entry point, often called main, which might parse some command-line arguments and then proceed to execute a loop that reads user input and produces output. The OS would load the program code into a process and then start executing it. Conceptually, this kind of process might look something like Figure 3-1.

A simple application in a process

Figure 3-1. A simple application in a process

With programs written in Java, it gets a little more complex: a Java virtual machine (VM) in a process loads bytecode to which it creates instances of Java classes as the program uses them. This process looks something like Figure 3-2. If you use a rich graphical user interface system like Swing, you might start a UI system on a second thread. It might use callbacks into the mainline code to process events.

A Java application, running in a Java virtual machine, in a process

Figure 3-2. A Java application, running in a Java virtual machine, in a process

Android introduces a richer approach by supporting multiple application entry points. Android programs should expect the system ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Android, 2nd Edition

Learning Android, 2nd Edition

Marko Gargenta, Masumi Nakamura
Learning Embedded Android N Programming

Learning Embedded Android N Programming

Ivan Morgillo, Stefano Viola

Publisher Resources

ISBN: 9781449332921Errata PageSupplemental Content