Creating Applications and Activities

WHAT'S IN THIS CHAPTER?

> An introduction to the Android application components and the different types of Android applications you can build with them

> The Android application life cycle

> How to create and annotate the application manifest

> How to use external resources to provide dynamic support for locations, languages, and hardware configurations

> How to implement and use your own Application class

> How to create new Activities

> Understanding an Activity's state transitions and life cycle

Before you start writing your own Android applications, it's important to understand how they're constructed and to have an understanding of the Android application life cycle. In this chapter you'll be introduced to the loosely coupled components that make up Android applications and how they're bound together by the Android manifest. Next you'll see how and why you should use external resources, before getting an introduction to the Activity component.

In recent years there's been a move toward development frameworks featuring managed code, such as the Java virtual machine and the .NET Common Language Runtime.

In Chapter 1 you learned that Android also uses this model, with each application running in a separate process on its own instance of the Dalvik virtual machine. In this chapter you'll learn more about the application life cycle and how it's managed by the Android run time. This leads to an introduction of the application process states. These states are used to determine an application's priority, which in turn affects the likelihood of an application's being terminated when more resources are required by the system.

Prepared for ASHLEE KABAT, email: [email protected] Order number: 56760408 This PDF is for the purchaser's personal use in accordance with the Wrox Terms of Service and under US copyright as stated on this book's copyright page. If you did not purchase this copy, please visit www.wrox.com to purchase your own copy.

Mobile devices come in a large variety of shapes and sizes and are used across the world. In this chapter you'll learn how to externalize resources to ensure your applications run seamlessly on different hardware (particularly different screen resolutions and pixel densities), in different countries, and supporting multiple languages.

Next you'll examine the Application class, and learn how to extend it to provide a place for storing application state values.

Arguably the most important of the Android building blocks, the Activity class forms the basis for all your user interface screens. You'll learn how to create new Activities and gain an understanding of their life cycles and how they affect the application lifetime.

Finally, you'll be introduced to some of the Activity subclasses that simplify resource management for some common user interface components such as maps and lists.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment