1page.title=Saving Data
2page.tags=data storage,files,sql,database,preferences
3helpoutsWidget=true
4
5trainingnavtop=true
6startpage=true
7
8@jd:body
9
10<div id="tb-wrapper">
11<div id="tb">
12
13<h2>Dependencies and prerequisites</h2>
14<ul>
15  <li>Android 1.6 (API Level 4) or higher</li>
16  <li>Familiarity with Map key-value collections</li>
17  <li>Familiarity with the Java file I/O API</li>
18  <li>Familiarity with SQL databases</li>
19</ul>
20
21<h2>You should also read</h2>
22<ul>
23  <li><a href="{@docRoot}guide/topics/data/data-storage.html">Storage Options</a></li>
24</ul>
25
26</div>
27</div>
28
29<p>Most Android apps need to save data, even if only to save information about the app state
30during {@link android.app.Activity#onPause onPause()} so the user's progress is not lost. Most
31non-trivial apps also need to save user settings, and some apps must manage large
32amounts of information in files and databases. This class introduces you to the
33principal data storage options in Android, including:</p>
34
35<ul>
36    <li>Saving key-value pairs of simple data types in a shared preferences
37file</li>
38    <li>Saving arbitrary files in Android's file system</li>
39    <li>Using databases managed by SQLite</li>
40</ul>
41
42
43<h2>Lessons</h2>
44
45<dl>
46  <dt><b><a href="shared-preferences.html">Saving Key-Value Sets</a></b></dt>
47    <dd>Learn to use a shared preferences file for storing small amounts of information in
48key-value pairs.</dd>
49
50  <dt><b><a href="files.html">Saving Files</a></b></dt>
51    <dd>Learn to save a basic file, such as to store long sequences of data that
52        are generally read in order.</dd>
53
54 <dt><b><a href="databases.html">Saving Data in SQL Databases</a></b></dt>
55   <dd>Learn to use a SQLite database to read and write structured data.</dd>
56
57</dl>
58