O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

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

17Saving and Loading Local Files

Almost every application needs a place to save data. In this chapter, you will enable CriminalIntent to save and load its data from a JSON file stored on the device’s filesystem.

Each application on an Android device has a directory in its sandbox. Keeping files in the sandbox protects them from being accessed by other applications or even the prying eyes of users (unless the device has been “rooted,” in which case the user can get to whatever he or she likes.)

Each application’s sandbox directory is a child of the device’s /data/data directory named after the application package. For CriminalIntent, the full path to the sandbox directory is /data/data/​com.bignerdranch.​android.​criminalintent.

While good ...

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