Data
persistence in
Android
CS-6TH
E
AYESHA JAVED (30)
Hira Saeed(46)
Hamna Nasir(55)
Tehseen Iqbal(06)
Is Android
supports only
SQLITE?
????
???
NONO
What is Data persistence?
• Persistence is "the continuance of an effect after its 
cause is removed". In the context of storing data in a 
computer system, this means that the data survives after 
the process with which it was created has ended. In 
other words, for a data store to be 
considered persistent, it must write to non-volatile 
storage
WHY Persisting data ?
• Persisting data is an important topic in application 
development, as users typically expect to reuse data in the 
future. For Android, there are primarily Four basic ways of 
persisting data:
• A lightweight mechanism known as shared preferences to save 
small chunks of data
• Traditional file systems (Internal)
• External systems (Flash,drive)..
• A relational database management system through the 
support of SQLite databases
Android Storage Options:-
Shared
Preferences
s
Shared preferences
internal structure
• Shared preferences internally has an in-memory storage on 
top of disk storage. Every operation goes through in-memory 
storage first and then to the disk.
• In-memory storage is basically a HashMap which allows O(1) 
runtime complexity for all operations.
V
CHECK THE
CODE OF
SHARED
PREFERENCES
CHECK THE
CODE OF
SHARED
PREFERENCES
Content
Provider
Ayesha javed(30)
Cursor cursor =
getContentResolver().query(Uri.parse(queryUri), projection,
selectionClause, selectionArgs, sortOrder);
• <provider android:name=".WordListContentProvider"
android:authorities="com.android.example.wordlistsqlwithco
ntentprovider.provider" android:exported="true"/>
``
• shared preferences are the location where you can store the
secret information for your app, like setting cookies in the
browser, this can be used for login credentials and other.
• where as content provider stores and retrieves the data and
make it available to other applications also. like suppose you
want to access the contacts available in the android phone,
they can be accessed by content providers
CHECK THE
CODE OF
CONTENT
PROVIDER
CHECK THE
CODE OF
CONTENT
PROVIDER
Internal
Storage
Hira saeed(46)
External
Storage
Hamna Nasir(55)
SQLITE
Tehseen Iqbal(06)
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM

DATA PERSISTENCE IN ANDROID OPERATING SYSTEM

Editor's Notes

  • #8 Store private and primitive data in key value pairs  Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char , short , int , long , float and double . These types serve as the building blocks of data manipulation in Java
  • #13 android.content.SharedPreferences.Editor Interface used for modifying values in a SharedPreferences object. All changes you make in an editor are batched, and not copied back to the original SharedPreferences until you call commit() or apply()
  • #18 HashMap is a Map based collection class that is used for storing Key &amp; value pairs, it is denoted as HashMap&amp;lt;Key, Value&amp;gt; or HashMap&amp;lt;K, V&amp;gt;.
  • #45 android:exported Whether the content provider is available for other applications to use:true: The provider is available to other applications. Any application can use the provider&amp;apos;s content URI to access it, subject to the permissions specified for the provider. false: The provider is not available to other applications. Set android:exported=&amp;quot;false&amp;quot;to limit access to the provider to your applications. Only applications that have the same user ID (UID) as the provider will have access to it.
  • #63 In revision control systems, a repository[1] is a data structure which stores metadata for a set of files or directory structure In computing, cross-platform software (also multi-platform software or platform-independent software) is computer software that is implemented on multiple computing platforms.[
  • #71 The main purpose CardView serves in the Material Design universe is to provide a unified look to all of the card based UIs making it easier for developers to create seamless interfaces. In this post, we will see what opportunities CardView provides on Android platform and how to use it properly in our application