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