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

Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 

Dernier (20)

Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 

Android101 - Content Providers