SlideShare uma empresa Scribd logo
1 de 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…

Mais conteúdo relacionado

Destaque

Aρχαια ελληνικα
Aρχαια ελληνικαAρχαια ελληνικα
Aρχαια ελληνικα
Voula13011972
 
Android Bootcamp
Android   BootcampAndroid   Bootcamp
Android Bootcamp
ahkjsdcsadc
 
Неделя психологии
Неделя психологииНеделя психологии
Неделя психологии
Tatyana Pustyakova
 
Android webinar class_6
Android webinar class_6Android webinar class_6
Android webinar class_6
Edureka!
 

Destaque (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
 

Semelhante a Android101 - Content Providers

Android contentprovider
Android contentproviderAndroid contentprovider
Android contentprovider
Krazy Koder
 
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
Woodruff 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 ii
Svetlin Nakov
 
ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity api
DrupalCamp Kyiv Рысь
 

Semelhante a 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
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
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
SoniaTolstoy
 
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
QucHHunhnh
 

Último (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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"
 
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
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
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
 
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
 

Android101 - Content Providers