What’s Next? Our Road Ahead
Before getting into the details of Android applications development, we’ll take a look at our “road ahead.” This chapter provides an overview of what is covered in this book, and why it’s covered in the order that we will cover it in.
You will see the logical progression throughout the book of how each chapter builds on the previous ones. We’ll move from setting up the Eclipse IDE in Chapter 3, to learning how Android works in Chapters 4 and 5, to adding exciting visuals and user interfaces (UIs) in Chapters 6 through 8, to adding interactivity and complexity in Chapters 9 through 11. The final chapter inspires you to keep learning about the more advanced features of the Android platform, as it continues to expand to encompass applications development for emerging consumer electronics platforms such as interactive television sets (iTVs), tablets, and e-book readers.
Your Android Development IDE
In Chapter 1, you downloaded the Java SE, Eclipse, and Android SDK packages you need to build an applications development environment for creating Android applications. In Chapter 3, you’ll learn how to set up these tools as a cohesive Android development environment, and then you’ll use this development environment throughout the rest of the book to create applications, or “apps.” You’ll do this by creating, step-by-step, from scratch, the very latest Android IDE out there—right on your very own development workstation.
Note that the latter part of this process must be done while online, so be sure to have your Internet connection active and firing on all cylinders. We’ll be connecting in real time, via Google’s Android developers website, to the latest Android application development tools, plug-ins, drivers, and documentation. We’ll even set you up with some other related new media tools such as the new GIMP 2.8.2 Digital Imaging software.
Although it might seem to you that the setup of Java SE, Eclipse IDE, Android’s SDK, and an Android Virtual Device (an emulator that mimics the behavior of a real Android smartphone or tablet) is a topic too trivial for an entire chapter, this task is actually one of the most critical in this book. If your Android IDE does not work 100% perfectly, your code will not work 100% perfectly. In fact, without a robust and properly configured IDE, you may not be able to develop any code at all!
The Eclipse IDE is a sophisticated programming environment that features code highlighting, device emulation, logic tracing, debugging, and a plethora of other advanced features. Figure 2-1 shows an example of working in Eclipse, and Figure 2-2 shows an Android Virtual Device in action.
Figure 2-1 . The Eclipse IDE
Note An Android Virtual Device is a software-based emulator that mimics the behavior of a real Android smartphone or tablet, as shown in Figure 2-2.
Figure 2-2 . An Android 4.1 Virtual Device (AVD) in action
In Chapter 3, you will learn how to customize the Eclipse Juno 4.2.1 for Java EE IDE with Android plug-ins, which will morph the Eclipse IDE tool into one that is tailored to the particular needs of an Android developer like yourself. As you will see, setting up the Eclipse Juno 4.2.1 for Java EE IDE for your specific Android development goals is not a trivial undertaking by any means.
Java, XML, and How Android Works
As you’ll learn in Chapter 4, an Android application is “stratified.” Its functionality is spelled out via Java code, its design via XML markup, and its privileges via the Android Manifest XML file in a way that is truly unique, modular, and powerful. This modularity adds a great deal of extensibility, or development flexibility, to applications.
Android makes heavy use of an XML-based markup language to define the basic component design of an application, especially its visual and user interface components. XML “markup” is not technically code, but rather consists of tags, similar to the HTML tags that web developers use to format their online documents. XML is used in Android to define everything from UIs to animation to data access, and even programmatic constructs such as Java object definitions and parameter configurations.
XML markup tags are easier for beginners to comprehend than a complex programming language like Java. For this reason, you’ll use XML throughout this book whenever possible, as Google recommends. Here, you’ll get a basic beginning knowledge of Android application development, yet this will still give you the ability to make your apps look very elegant and professional. I call it getting the maximum return on your investment, and XML makes this possible for the absolute beginner, and thus we will leverage it wherever and whenever possible within this book.
The Android Application Framework
By the time you reach Chapter 5, you’ll have built a rock-solid integrated Android application software development environment. You also will have acquired a basic understanding of the components that make up an application development project (images, text, layout, buttons, code, audio, video, animation, XML, etc.), built your very first Android application, and run it in the AVD emulator as an Android 4.1 app.
In Chapter 5, you’ll learn the unique lingo of Android application design—that is, what the various components of an Android application are called, and some background regarding how the Java programming language works.
I’ll outline how Java programming logic or code and XML, along with any new media resources, are compiled, compressed, and bundled into Android’s signature .apk file type (APK stands for Android PacKage), and how the various Android application components “talk” to each other inside your application.
Chapter 5 also provides an overview of Android activities, which define the user experience on the screen, and explains how they operate. You’ll learn about Android services as well, which run in the background, separate from the application’s activities, and provide the user with advanced functions through the UI.
You’ll also take an initial look at broadcast receivers , which alert an Android application to events of interest, such as the activation of a camera on an Android device, or an incoming phone call. In fact, your app can even send out its own broadcasts, if there is some reason to let other applications know of a change in state in one of your application’s data constructs.
The chapter finishes up with a look at content providers, which are often databases filled with information, such as a contact list, that applications may want to access to provide functionality of their own. Android ships with a number of preconfigured content providers, and you can also write your own.
By Chapter 6, you will have a better idea of how the Android operating system works internally, and how it wants to see applications put together. You’ll be ready to design visual graphics, user interfaces (UI), and ultimately user experiences for your Android applications.
You’ll do all of this using screen constructs called views and view groups (grouped views) which are flexible layout containers, which can be nested inside each other to create any custom UI for your application needs.
Chapter 6 explains how the display screen—the way most users interact with an Android application—is handled in Android, using a mixture of Java code and XML markup that controls the hierarchy of View and ViewGroup objects and Layout containers. You can also “extend” these Java classes by adding your own custom code to create your own custom View objects and Layout containers, when you need a more complex design. These ViewGroup layout containers ultimately hold the other visual and UI content in your application in its proper place, and thus are the foundation of your application design. You’ll want to learn these screen view and layout concepts thoroughly, as they are core concepts to implementing everything else that Android can do. After all, without a proper user interface, your software functionality cannot be accessed by your end-users in the first place!
You’ll revisit XML yet again in Chapter 6, and learn how it allows you to define complex screen layouts and UI designs without writing a single line of Java code. You’ll learn about the different types of layout containers, and how each can be useful in different UI design scenarios, and even code a really cool application that is written almost completely with XML (eXtensible markup language).
In Chapter 7, we’ll start building usable UI designs, using the XML foundation of the previous chapters, via your screen layout and view controls, and Eclipse’s powerful Graphical Layout Editor.
We’ll cover the primary or mainstream screen resolutions for you to design UIs for Android, and which options you have for providing extra-high-, high-, medium-, and low-resolution graphics that allow Android to fit your application to each common device screen size and device type, such as smartphone, tablet, e-reader, or iTV. We’ll also cover the creation of standardized Android icons for use in your UI designs for each of these primary four screen densities.
Android has a large number of UI elements, such as buttons, text fields, radio buttons, check boxes, menus, alert dialogs, and all of those familiar controls that allow users to interface with application software functions. These items can be implemented both in Java as well as in XML.
In Chapter 7, we’ll again design and code another usable Android application. We’ll design views, layouts, and UI elements as well as attaching their XML design elements to Java code that performs some simple functions when the UI elements are used by the application’s users.
We’ll look at the differences between option menus and context-sensitive menus as well as submenus for both of these types of menu constructs. We’ll also review different types of dialog boxes such as alert dialogs, progress dialogs, and dialogs for picking dates and times.
In Chapter 8, we’ll start adding application new media elements through images and animation. These new media elements are key to making your application look great across all Android devices.
The Android smartphone Active-Matrix Organic Light-Emitting Diode (AMOLED) half-size video graphics array (HVGA) and the wide video graphics array (WVGA) screens on current Android tablet and e-reader products are impressive enough these days to allow some amazing experiences to be created, so this is where it starts to get interesting, as far as the application visuals are concerned.
In Chapter 8, we’ll explore the following
In Chapter 9, we’ll talk about adding interactivity to your applications, so that they respond to user input and actually do something useful. You will do this by handling UI events. We’ll look at the most efficient way of handling events that are triggered by your users using the UI elements (Views) that are attached to the ViewGroups (UI layout containers) that you have defined within your XML files.
The following topics are covered:
In Chapter 10, we’ll be ready to get into the complexity of accessing data structures and Android content providers. These content providers allow you to access databases of system information that are available through the Android operating system as well as your own databases of information.
Content providers are the primary method Android provides for sharing stored data across applications, which is why they are important enough to merit their own chapter. We’ll take a close look at the features of Android that allow you to query data regarding items common to the Android platform such as images, video, audio, and contacts.
In addition, you can create your own content providers or add data to an existing one. You’ll see how to create a content resolver so that you can interface with whichever content providers you choose (and for which you have permissions to access).
You’ll learn about how content providers expose their data via data models similar to SQL databases, and about how to use cursors to traverse the Android SQLite databases in various ways.
Finally, we’ll investigate URI objects, and how to use them to identify and access data sets. Each set of data in the database will have its own uniform resource identifier (URI), which is similar to an HTTP URL.
In Chapter 11, we are going to tackle one of the more complex concepts in the Android development environment: intents. Intents are asynchronous messages (members of the Intents class) that travel between Android’s activities, services, and broadcast receiver components. Asynchronous means they are not synchronized; that is, the messages can be sent and received independently (not in sync, but without any pattern or order) from each other.
Using intents allows you to take your current Android applications to an entirely new level of complexity. Prior to this chapter, you’ll have added functionality to your application by accessing the cool functions that Android provides. But all easy things must come to an end, so they say.
Armed with intents (no pun intended), you can create advanced programming logic of your own that ties together everything you have learned in the previous chapters. This allows for far more powerful and useful programming constructs, and takes you from an absolute beginner to an intermediate level.
You’ll learn how to spawn Intent objects that can carry highly customized messages back and forth between your Android UI (activities) and your programming logic (services), for instance, as well as to and from broadcast receiver components.
We’ll also look at intent resolution and intent filters. These allow you to filter out events that your apps do not need to be concerned with, allowing you to optimize the processing of internal communications.
The Future of Android
In the final chapter, I expose you to all of those fascinating areas within the Android development environment that we did not have the bandwidth to cover in this book, as well as to some troubleshooting techniques. There may be a lot of unfamiliar names and acronyms in this chapter, but that’s the nature of the future of Android.
The 3D engine inside of Android is called OpenGL ES 2.0, and OpenGL ES 3.0 is right around the corner as well. You’ll see how it allows you to create amazing real-time rendered 3D games and applications. And I’ll give you some great resources to find out more about this powerful 3D engine.
The SQLite database exists right inside the Android operating system, in fact, it has its own library of classes. We’ll uncover the power it offers in allowing client-side databases to be created and used as content providers inside your applications.
Smartphone hardware such as the high-definition camera, GPS, accelerometer, touchscreen, and microphone can be used to capture and digitize real-world events around us as images, audio, and gestures, and turn them into data that can be used inside your applications. Computer programming has never been so powerful and so highly innovation oriented.
Inter-Android communication is another hot area, especially because Android devices can be used as wireless hubs, giving access to many. We will look at Android’s integrated Bluetooth and NFC APIs, which allow Android applications to wirelessly connect with any Android device nearby, and even provide for multiple connections, or allow applications to talk to each other between Android hardware devices such as iTVs, Smartphones, Tablets, and e-Readers.
Have you seen that TV commercial where the Android users touch phones to transfer files? This is Inter-Android Communication APIs at work.
We’ll cover the concept of creating app widgets, or miniature applications that can be embedded in other applications (think: the Android home screen) and receive real-time updates (for widgets like clocks, radios, and weather stations).
Finally, we’ll consider the popular area of locations and maps using the Android location package and Google Maps as an external data library. These tools are valuable for Android application development, due to the mobile nature of the smartphone, tablet, and e-readers, and the fact that most have a built-in GPS.
Summary
As you can see from this chapter, this book will take you on a wild journey through the various parts and components of the Android operating environment—from UI design, to new media assets, to database access, to more complicated background services and interapplication messaging. We’ll be dealing with adding some pretty cool elements to Android applications, mainly by leveraging the power of “design via XML” and many of Android’s powerful built-in features.
In the next chapter, you’ll build an Eclipse-based Android IDE using the open source applications development software packages that you downloaded at the end of Chapter 1. After that, you’ll learn about how the Android development environment is modularized as well as how to set it up to create Android applications using this diverse mobile operating system. You’ll also get some new media related software packages set-up that you can use to take your Android development to an entirely different (visual) level, some of which are actually used in this book.
Enough excitement and anticipation! Let’s get right into turning your workstation into an Android app development machine!
44.200.94.150