Android Tutorial

(avery) #1

By : Ketan Bhimani


294 

Finding Preferences Data on the Android File System

Internally, application preferences are stored as XML files. You can
access the preferences file using DDMS using the File Explorer. You
find these files on the Android file system in the following directory:

/data/data//shared_prefs/.xml


The preferences filename is the Activity’s class name for private
preferences or the name you give for the shared preferences. Here
is an example of the file contents of a simple preference file with a
preference in each data type:

<?xml version=”1.0” encoding=”utf-8” standalone=”yes” ?>



Test String





Understanding the application preferences file format can be helpful
for testing purposes. You can use Dalvik Debug Monitor Service
(DDMS) to copy the preferences files to and from the device.

Working with Files and Directories

Remember from Chapter “Introducing Android,” that each Android
application is its own user on the underlying Linux operating
system. It has its own private application directory and files. Within
the Android SDK, you can also find a variety of standard Java file
utility classes (such as java.io) for handling different types of files,
such as text files, binary files, and XML files.

In Chapter “Managing Application Resources,” you also learned that
Android applications can also include static raw and XML files as
Free download pdf