Professional Documents
Culture Documents
Android Application Development: Data Management
Android Application Development: Data Management
Android Application Development: Data Management
Data Management
Saving Data Storage Option
• boolean isDirectory()
• Return true if this File represents a
directory
• String getAbsolutePath()
• Returns the absolute path to this File
• boolean setReadable(boolean readable)
• Sets read permission on this File
• Many others. You can those methods in
documentation.
Writing an Internal File File Storage
• A persistent map
• Holds key-value pairs of primitive data types
• Automatically managed across application uses
• Often used for long-term storage of customizable
application data such as user preferences, e.g.,
• User ID
• Favorite Wifi networks
SharedPreferences Preferences
SharedPreferences Preferences
• Call SharedPreferences.edit()
• Returns a SharedPreferences.Editor instance
• Add values with SharedPreferences.Editor
• Commit values with
• SharedPreferences.Editor.commit()
Reading SharedPreferences Preferences
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key = "@+id/pref_screen">
<EditTextPreference
android:negativeButtonText="Cancel"
android:dialogMessage="Enter Your User Name"
android:dialogTitle="User Name"
android:positiveButtonText="Submit"
android:title="User Name" android:key="uname">
</EditTextPreference>
</PreferenceScreen>
SQLite Database SQLite
Features:
1. Self-contained, Serverless, Zero-configuration and Transactional
2. A complete database is stored in a single cross-platform disk file.
3. Supports terabyte-sized databases and gigabyte-sized strings and blobs.
4. Small code footprint
5. Faster than popular client/server database engines for most operations.
6. Simple, easy to use API.
7. Written in ANSI-C.
8. Cross-platform: Unix (Linux, Mac OS-X, Android, iOS) and Windows
(Win32, WinCE, WinRT) are supported out of the box. Easy to port t
other systems.
9. Sources are in the public domain. Use for any purpose.
10. Comes with a standalone command-line interface (CLI) client that can
be used to administer SQLite databases.
Saving Data into a Database Database SQLite
3. RDBMS Example
Saving Data into a Database Database SQLite
3. RDBMS Example
Saving Data into a Database Database SQLite