SlideShare a Scribd company logo
1 of 53
Download to read offline
SharedPreferences
Internal Storage
External Storage
SQLite databases
Small amounts of primitive data
Small to medium amounts of private
data
Larger amounts of non-private data
Store small to large amounts of
private, structured data
A persistent map
Holds key-value pairs of simple data
types
Automatically persisted across
application sessions
Often used for long-term storage of
customizable application data
Account name
Favorite WiFi networks
User customizations
To get a SharedPreference object
associated with a given Activity
Activity.getPreferences (int mode)
MODE_PRIVATE
Context.getSharedPreferences ("

 
 
String name, int mode)
name – name of SharedPreferences file
Mode – MODE_PRIVATE
Call SharedPreferences.edit()
Returns a SharedPreferences.Editor
instance
Add values to SharedPreferences using
SharedPreferences.Editor instance
putInt(String key, int value)
putString(String key, String value)
remove(String key)
Commit edited values with 
SharedPreferences.Editor.commit()
Use SharedPreferences methods to read
values
getAll()
getBoolean(String key, …) 
getString(String key, …)
When the user presses the play button,
the application displays a random
number
The application keeps track of the
highest number seen so far
A Class that supports displaying &
modifying user preferences
This application displays a
PreferenceFragment, which allows the
user to enter and change a persistent
user name
Class represents a file system entity
identified by a pathname
Storage areas are classified as
internal or external
Internal memory usually used for
smaller, application private data sets
External memory usually used for
larger, non-private data sets
FileOutputStream
openFileOutput (String name, int mode)
Open private file for writing. Creates the
file if it doesn't already exist
FileInputStream
openFileInput (String name)
Open private file for reading
Many others. See documentation.
If a text file does not already exist,
application writes text to that text file
Application then reads data from the
text file and displays it
Removable media may appear/disappear
without warning
String Environment.
 
 
 
 

 
 
getExternalStorageState()
MEDIA_MOUNTED - present & mounted
with read/write access
MEDIA_MOUNTED_READ_ONLY - present
& mounted with read-only access
MEDIA_REMOVED - not present
Etc.
Permission to write external files
<uses-permission android:name= "
“android.permission."

WRITE_EXTERNAL_STORAGE" />
Application reads an image file from
the resources directory
Copies that file to external storage
Reads image data from the file in
external storage
then displays the image
Temporary files that may be deleted by
the system when storage is low
Files removed when application
uninstalled
File Context.getCacheDir()
Returns absolute path to an
application-specific directory that can
be used for temporary files
Context.getExternalCacheDir() 
returns a File representing external
storage directory for cache files
SQLite provides in-memory database
Designed to operate within a very small
footprint (<300kB)
Implements most of SQL92
Supports ACID transactions
Atomic, Consistent, Isolated & Durable
Recommended method relies on a helper
class called SQLiteOpenHelper
Subclass SQLiteOpenHelper
Call super() from subclass
constructor to initialize underlying
database
Override onCreate() 
Override onUpgrade()
Execute CREATE TABLE commands
Use SQLiteOpenHelper methods to
open & return underlying database
Execute operations on underlying
database
Application creates an SQLite database
and inserts records, some with errors,
into it
When user presses the Fix button, the
application deletes, updates and
redisplays the corrected database
records
Databases stored in
/data/data/<package name>/databases/
Can examine database with sqlite3
# adb -s emulator-5554 shell
# sqlite3 /data/data/
course.examples.DataManagement.Data
BaseExample/databases/artist_dbd
ContentProvider

More Related Content

What's hot

Android database tutorial
Android database tutorialAndroid database tutorial
Android database tutorialinfo_zybotech
 
Design of file system architecture with cluster
Design of file system architecture with clusterDesign of file system architecture with cluster
Design of file system architecture with clustereSAT Publishing House
 
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingSensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingJAYAPRAKASH JPINFOTECH
 
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingSensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingJAYAPRAKASH JPINFOTECH
 
Databases in Android Application
Databases in Android ApplicationDatabases in Android Application
Databases in Android ApplicationMark Lester Navarro
 
Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0LiquidHub
 
Clustering of medline documents using semi supervised spectral clustering
Clustering of medline documents using semi supervised spectral clusteringClustering of medline documents using semi supervised spectral clustering
Clustering of medline documents using semi supervised spectral clusteringeSAT Publishing House
 

What's hot (10)

ado.net
ado.netado.net
ado.net
 
Android Database
Android DatabaseAndroid Database
Android Database
 
Android database tutorial
Android database tutorialAndroid database tutorial
Android database tutorial
 
Design of file system architecture with cluster
Design of file system architecture with clusterDesign of file system architecture with cluster
Design of file system architecture with cluster
 
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingSensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
 
Ado.net
Ado.netAdo.net
Ado.net
 
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data PublishingSensitive Label Privacy Preservation with Anatomization for Data Publishing
Sensitive Label Privacy Preservation with Anatomization for Data Publishing
 
Databases in Android Application
Databases in Android ApplicationDatabases in Android Application
Databases in Android Application
 
Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0
 
Clustering of medline documents using semi supervised spectral clustering
Clustering of medline documents using semi supervised spectral clusteringClustering of medline documents using semi supervised spectral clustering
Clustering of medline documents using semi supervised spectral clustering
 

Similar to Data management

Data Storage In Android
Data Storage In Android Data Storage In Android
Data Storage In Android Aakash Ugale
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Khaled Anaqwa
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorageKrazy Koder
 
Android App Development - 09 Storage
Android App Development - 09 StorageAndroid App Development - 09 Storage
Android App Development - 09 StorageDiego Grancini
 
Mobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfMobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfAbdullahMunir32
 
03 programmation mobile - android - (stockage, multithreads, web services)
03 programmation mobile - android - (stockage, multithreads, web services)03 programmation mobile - android - (stockage, multithreads, web services)
03 programmation mobile - android - (stockage, multithreads, web services)TECOS
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOSMake School
 
12_Data_Storage_Part_2.pptx
12_Data_Storage_Part_2.pptx12_Data_Storage_Part_2.pptx
12_Data_Storage_Part_2.pptxFaezNasir
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT TalkConstantine Mars
 
Architecture Components
Architecture Components Architecture Components
Architecture Components DataArt
 
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WPNguyen Tuan
 
Techniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentTechniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentJeremy Hutchinson
 

Similar to Data management (20)

Data Storage In Android
Data Storage In Android Data Storage In Android
Data Storage In Android
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)
 
Android - Saving data
Android - Saving dataAndroid - Saving data
Android - Saving data
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
Android Data Storagefinal
Android Data StoragefinalAndroid Data Storagefinal
Android Data Storagefinal
 
Android App Development - 09 Storage
Android App Development - 09 StorageAndroid App Development - 09 Storage
Android App Development - 09 Storage
 
Mobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfMobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdf
 
03 programmation mobile - android - (stockage, multithreads, web services)
03 programmation mobile - android - (stockage, multithreads, web services)03 programmation mobile - android - (stockage, multithreads, web services)
03 programmation mobile - android - (stockage, multithreads, web services)
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOS
 
12_Data_Storage_Part_2.pptx
12_Data_Storage_Part_2.pptx12_Data_Storage_Part_2.pptx
12_Data_Storage_Part_2.pptx
 
Level 4
Level 4Level 4
Level 4
 
Application Hosting
Application HostingApplication Hosting
Application Hosting
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT Talk
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
 
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP
 
Android Data Persistence
Android Data PersistenceAndroid Data Persistence
Android Data Persistence
 
6.C#
6.C# 6.C#
6.C#
 
Memory management
Memory managementMemory management
Memory management
 
Hadoop HDFS Concepts
Hadoop HDFS ConceptsHadoop HDFS Concepts
Hadoop HDFS Concepts
 
Techniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentTechniques for Cross Platform .NET Development
Techniques for Cross Platform .NET Development
 

More from maamir farooq (20)

Ooad lab1
Ooad lab1Ooad lab1
Ooad lab1
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Php client libray
Php client librayPhp client libray
Php client libray
 
Swiftmailer
SwiftmailerSwiftmailer
Swiftmailer
 
Lect15
Lect15Lect15
Lect15
 
Lec 7
Lec 7Lec 7
Lec 7
 
Lec 6
Lec 6Lec 6
Lec 6
 
Lec 5
Lec 5Lec 5
Lec 5
 
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheet
 
Assignment
AssignmentAssignment
Assignment
 
Java script summary
Java script summaryJava script summary
Java script summary
 
Lec 3
Lec 3Lec 3
Lec 3
 
Lec 2
Lec 2Lec 2
Lec 2
 
Lec 1
Lec 1Lec 1
Lec 1
 
Css summary
Css summaryCss summary
Css summary
 
Manual of image processing lab
Manual of image processing labManual of image processing lab
Manual of image processing lab
 
Session management
Session managementSession management
Session management
 
Content provider
Content providerContent provider
Content provider
 
Android sq lite database tutorial
Android sq lite database tutorialAndroid sq lite database tutorial
Android sq lite database tutorial
 

Recently uploaded

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

Data management