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.
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, ...
Get Developing Android Applications with Adobe AIR now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.