O'Reilly logo

Developing Android Applications with Adobe AIR by Véronique Brossier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Opening and Closing an Application and Saving Data

The difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.

Linus Benedict Torvalds

In Android, every application, also called an activity, is given a unique user ID and runs in its own process. The system—more specifically, the Activity Manager—manages the life cycle of applications and provides a common activity stack.

The application life cycle has three states: active, paused, and stopped. The Activity Manager keeps track of the list of application processes currently running, in order, from newest to oldest. If memory is needed, the oldest application is terminated first. It may receive an event first or be terminated at once.

The decision is therefore very much a result of the user’s interaction and history, with the current activity being the most important. AIR applications on Android are treated as any other application, as we will see in this chapter.

While an application has a limited life cycle, it has the ability to save persistent data. Android provides an SQLite database, document-like data, as well as an internal state, which is a simple set of name/value pairs associated with an activity.

AIR uses its own APIs to save data. The AIR runtime comes with an SQLite engine and access to the filesystem. It also provides local shared objects, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required