Chapter 30. Accessing Files
While Android offers structured storage, via preferences and databases, sometimes a simple file will suffice. Android offers two models for accessing files: one for files prepackaged with your application and one for files created on-device by your application.
You and the Horse You Rode in On
Let's suppose you have some static data you want to ship with the application, such as a list of words for a spell checker. The easiest way to deploy that is to put the file in the
res/raw directory, so that it will be put in the Android application APK file as part of the packaging process as a raw resource.
To access this file, you need to get yourself a
Resources object. From an activity, that is as simple as calling