SlideShare une entreprise Scribd logo
1  sur  17
Content
Providers
Please download and open:
http://goo.gl/aDmGsR
ContentProvider
 Manages data
 Can use almost any storage option
 SQLite
 File
 API
 …
 Provides consistent interface (CRUD)
 Can be restricted with permissions
extends ContentProvider class
Use Case
Objects
Storage
Interactions
ContentProvider
Registers
ContentResolverContentResolver
CRUD
CRUD
CRUD
Your App
Other Apps
Platform
CRUD
Method Usage
insert Inserts one object. The URI must be directory-based
query Queries for all objects that fit the URI.
update Updates one or all object(s)
delete Deletes the object(s) for the URI provided.
Insert (Create)
Type Name Usage
URI uri The URI of the object(s) to access.
ContentValues values The values for the object to add.
Query (Read)
Type Name Usage
URI uri The URI of the object(s) to access.
String[] projection This String array indicates which
columns/attributes of the objects you
want to access
String selection With this argument you can determine
which records to return
String[] selectionArgs The binding parameters to the
previous selection argument
String sortOrder If the result should be ordered you
must use this argument to determine
the sort order
Query (sample)
Update(Update)
Type Name Usage
URI uri The URI of the object(s) to
access.
ContentValues values The values for the object to
add.
String selection With this argument you can
determine which records to
affect
String[] selectionArgs The binding parameters to the
previous selection argument
Delete(Delete)
Type Name Usage
URI uri The URI of the object(s) to
access.
String selection With this argument you can
determine which records to
affect
String[] selectionArgs The binding parameters to the
previous selection argument
Use Case (people)
URI
 content://authority/path/id
 authority: is Java namespace of the
content provider implementation. (fully
qualified Java package name)
 path: is the virtual directory within the
provider that identifies the kind of data
being requested.
 id: is optional part that specifies the primary
key of a record being requested. We can
omit this part to request all records.
URI (sample)
 authority: our authority is…
com.example.rememberme.provider.PersonContentProvider
 path: using table name
person
UriMatcher
 Helper class to match URIs to a specific
integer codes.
UriMatcher (sample)
MIME Types
 Used to determine supported object
types
 Prefixed with:
 vnd.android.cursor.item
 Single item
 vnd.android.cursor.dir
 List of items
MIME Types (sample)
Let’s get coding…

Contenu connexe

En vedette

Android101 - Intro and Basics
Android101 - Intro and BasicsAndroid101 - Intro and Basics
Android101 - Intro and Basicsjromero1214
 
Tourisme, culture et patrimoine.
Tourisme, culture et patrimoine.Tourisme, culture et patrimoine.
Tourisme, culture et patrimoine.edelcroix
 
Aρχαια ελληνικα
Aρχαια ελληνικαAρχαια ελληνικα
Aρχαια ελληνικαVoula13011972
 
Decision analysis part iii
Decision analysis part iiiDecision analysis part iii
Decision analysis part iiiAsk To Solve
 
Decision analysis (Part I)
Decision analysis (Part I)Decision analysis (Part I)
Decision analysis (Part I)Ask To Solve
 
Decision analysis part ii
Decision analysis part iiDecision analysis part ii
Decision analysis part iiAsk To Solve
 
Ask to solve tools mind map
Ask to solve   tools   mind mapAsk to solve   tools   mind map
Ask to solve tools mind mapAsk To Solve
 
Android application development fundamentals
Android application development fundamentalsAndroid application development fundamentals
Android application development fundamentalsindiangarg
 
Android Bootcamp
Android   BootcampAndroid   Bootcamp
Android Bootcampahkjsdcsadc
 
Growing and Preserving Your Own Fruits and Vegetables
Growing and Preserving Your Own Fruits and VegetablesGrowing and Preserving Your Own Fruits and Vegetables
Growing and Preserving Your Own Fruits and VegetablesSherry Ellis
 
Неделя психологии
Неделя психологииНеделя психологии
Неделя психологииTatyana Pustyakova
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications developmentAlfredo Morresi
 
Android webinar class_6
Android webinar class_6Android webinar class_6
Android webinar class_6Edureka!
 

En vedette (20)

Android101 - Intro and Basics
Android101 - Intro and BasicsAndroid101 - Intro and Basics
Android101 - Intro and Basics
 
Change
ChangeChange
Change
 
la honestidad. ¡
la honestidad. ¡la honestidad. ¡
la honestidad. ¡
 
Change
ChangeChange
Change
 
Tourisme, culture et patrimoine.
Tourisme, culture et patrimoine.Tourisme, culture et patrimoine.
Tourisme, culture et patrimoine.
 
Aρχαια ελληνικα
Aρχαια ελληνικαAρχαια ελληνικα
Aρχαια ελληνικα
 
Decision analysis part iii
Decision analysis part iiiDecision analysis part iii
Decision analysis part iii
 
Decision analysis (Part I)
Decision analysis (Part I)Decision analysis (Part I)
Decision analysis (Part I)
 
Decision analysis part ii
Decision analysis part iiDecision analysis part ii
Decision analysis part ii
 
Ask to solve tools mind map
Ask to solve   tools   mind mapAsk to solve   tools   mind map
Ask to solve tools mind map
 
The Leadership Mouse Trap
The Leadership Mouse TrapThe Leadership Mouse Trap
The Leadership Mouse Trap
 
Android application development fundamentals
Android application development fundamentalsAndroid application development fundamentals
Android application development fundamentals
 
Android in practice
Android in practiceAndroid in practice
Android in practice
 
Android Bootcamp
Android   BootcampAndroid   Bootcamp
Android Bootcamp
 
Growing and Preserving Your Own Fruits and Vegetables
Growing and Preserving Your Own Fruits and VegetablesGrowing and Preserving Your Own Fruits and Vegetables
Growing and Preserving Your Own Fruits and Vegetables
 
Presentació Associació de la Fusta Estructural (AFE)
Presentació Associació de la Fusta Estructural (AFE)Presentació Associació de la Fusta Estructural (AFE)
Presentació Associació de la Fusta Estructural (AFE)
 
Неделя психологии
Неделя психологииНеделя психологии
Неделя психологии
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
 
Android basics
Android basicsAndroid basics
Android basics
 
Android webinar class_6
Android webinar class_6Android webinar class_6
Android webinar class_6
 

Similaire à Android101 - Content Providers

Android content providers
Android content providersAndroid content providers
Android content providersKurt Mbanje
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentproviderKrazy Koder
 
Android App Development - 10 Content providers
Android App Development - 10 Content providersAndroid App Development - 10 Content providers
Android App Development - 10 Content providersDiego Grancini
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocolWoodruff Solutions LLC
 
5. c sharp language overview part ii
5. c sharp language overview   part ii5. c sharp language overview   part ii
5. c sharp language overview part iiSvetlin Nakov
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)Khaled Anaqwa
 
Custom content provider in android
Custom content provider in androidCustom content provider in android
Custom content provider in androidAly Arman
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object javamha4
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objectsmaznabili
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptmanomkpsg
 
ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity apiDrupalCamp Kyiv Рысь
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API ModuleSergiu Savva
 

Similaire à Android101 - Content Providers (20)

Android content providers
Android content providersAndroid content providers
Android content providers
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentprovider
 
Android App Development - 10 Content providers
Android App Development - 10 Content providersAndroid App Development - 10 Content providers
Android App Development - 10 Content providers
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
 
C# overview part 2
C# overview part 2C# overview part 2
C# overview part 2
 
5. c sharp language overview part ii
5. c sharp language overview   part ii5. c sharp language overview   part ii
5. c sharp language overview part ii
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
 
Objects and Types C#
Objects and Types C#Objects and Types C#
Objects and Types C#
 
Custom content provider in android
Custom content provider in androidCustom content provider in android
Custom content provider in android
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object java
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objects
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Cis166 final review c#
Cis166 final review c#Cis166 final review c#
Cis166 final review c#
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.ppt
 
Generic
GenericGeneric
Generic
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity api
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API Module
 

Dernier

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
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
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Dernier (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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"
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Android101 - Content Providers