blob: aa223f641f236561699459a2d65214a15f9b7614 [file] [log] [blame]
page.title=Saving Data
page.tags=data storage,files,sql,database,preferences
helpoutsWidget=true
trainingnavtop=true
startpage=true
@jd:body
<div id="tb-wrapper">
<div id="tb">
<h2>Dependencies and prerequisites</h2>
<ul>
<li>Android 1.6 (API Level 4) or higher</li>
<li>Familiarity with Map key-value collections</li>
<li>Familiarity with the Java file I/O API</li>
<li>Familiarity with SQL databases</li>
</ul>
<h2>You should also read</h2>
<ul>
<li><a href="{@docRoot}guide/topics/data/data-storage.html">Storage Options</a></li>
</ul>
</div>
</div>
<p>Most Android apps need to save data, even if only to save information about the app state
during {@link android.app.Activity#onPause onPause()} so the user's progress is not lost. Most
non-trivial apps also need to save user settings, and some apps must manage large
amounts of information in files and databases. This class introduces you to the
principal data storage options in Android, including:</p>
<ul>
<li>Saving key-value pairs of simple data types in a shared preferences
file</li>
<li>Saving arbitrary files in Android's file system</li>
<li>Using databases managed by SQLite</li>
</ul>
<h2>Lessons</h2>
<dl>
<dt><b><a href="shared-preferences.html">Saving Key-Value Sets</a></b></dt>
<dd>Learn to use a shared preferences file for storing small amounts of information in
key-value pairs.</dd>
<dt><b><a href="files.html">Saving Files</a></b></dt>
<dd>Learn to save a basic file, such as to store long sequences of data that
are generally read in order.</dd>
<dt><b><a href="databases.html">Saving Data in SQL Databases</a></b></dt>
<dd>Learn to use a SQLite database to read and write structured data.</dd>
</dl>