Why and How to Save Data

As I mentioned previously, you don’t have full control over when your application becomes inactive or is terminated. Think of your application flow and building blocks and determine which states are important to save and under what circumstances.

Saving data is essential for a good user experience and for continuity. Saving should be considered when the application is about to exit, when it goes to the background, and at small intervals while your application is active.

To keep your audience engaged, avoid having them go over the same introductory steps every time they launch your application. Instead, bring them directly to the application’s core. Your application may be the scheduler of an event occurring over several days. Keep track of the date it was last used and display it first the next time the application is opened.

Persistent data may be an important component of your application, as in a game where the usernames and scores are saved and can be improved upon. If your game was interrupted in the middle of game play, keep track of its progress and display it in the same state the next time it is visible.

Data may be an essential part of your application if the user has the opportunity to build a library of information to manipulate and save over time. If your application is a utility for collecting a selection of images, a storage mechanism is the core of its functionality.

Internal or External Storage?

Let’s consider where to save data first. Data can ...

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.