SlideShare uma empresa Scribd logo
1 de 11
1. ContentProvider used to get data from central repository.
2. Android application contains content provider to provide
data to other applications.
3. you can also create your custom content provider to get data
from database / sdcard / media etc
Content URIs
To query a content provider, you specify the query string in the form of a URI which has following
format −
<prefix>://<authority>/<data_type>/<id>
Sr.No Part & Description
1
prefix
This is always set to content://
2
authority
This specifies the name of the content provider, for example contacts, browser etc. For third-party content providers, this could
be the fully qualified name, such as com.tutorialspoint.statusprovider
3
data_type
This indicates the type of data that this particular provider provides. For example, if you are getting all the contacts from
the Contactscontent provider, then the data path would be people and URI would look like thiscontent://contacts/people
4
id
This specifies the specific record requested. For example, if you are looking for contact number 5 in the Contacts content
provider then URI would look like this content://contacts/people/5.
// A "projection" defines the columns that will be returned for each row
String[] mProjection=
{
ContactsContract.Contacts._ID, // Contract class constant for the _ID column
name
ContactsContract.Contacts.DISPLAY_NAME // Contract class constant for the
DISPLAY_NAME column name
};
Content provider
Content provider

Mais conteúdo relacionado

Semelhante a Content provider

Mobile Application Development -Lecture 11 & 12.pdf
Mobile Application Development -Lecture 11 & 12.pdfMobile Application Development -Lecture 11 & 12.pdf
Mobile Application Development -Lecture 11 & 12.pdf
AbdullahMunir32
 
Timeline SoMa WADE
Timeline SoMa WADETimeline SoMa WADE
Timeline SoMa WADE
Irnuk
 
p2p project report
p2p project reportp2p project report
p2p project report
Yuming Guo
 
1. Create and call a function to � Open a text file for storing the.pdf
1. Create and call a function to � Open a text file for storing the.pdf1. Create and call a function to � Open a text file for storing the.pdf
1. Create and call a function to � Open a text file for storing the.pdf
agaramjareld
 
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docxCopyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
bobbywlane695641
 
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External SourcesTERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
Terminalfour
 

Semelhante a Content provider (20)

Secure Sharing PHI PCI PII -Android app_Content Provider
Secure Sharing PHI PCI PII -Android app_Content ProviderSecure Sharing PHI PCI PII -Android app_Content Provider
Secure Sharing PHI PCI PII -Android app_Content Provider
 
DC-2008 Tutorial 3 - Dublin Core and other metadata schemas
DC-2008 Tutorial 3 - Dublin Core and other metadata schemasDC-2008 Tutorial 3 - Dublin Core and other metadata schemas
DC-2008 Tutorial 3 - Dublin Core and other metadata schemas
 
Ag Data Commons: Agricultural research metadata and data
Ag Data Commons: Agricultural research metadata and dataAg Data Commons: Agricultural research metadata and data
Ag Data Commons: Agricultural research metadata and data
 
Level 4
Level 4Level 4
Level 4
 
Mobile Application Development -Lecture 11 & 12.pdf
Mobile Application Development -Lecture 11 & 12.pdfMobile Application Development -Lecture 11 & 12.pdf
Mobile Application Development -Lecture 11 & 12.pdf
 
03 android application structure
03 android application structure03 android application structure
03 android application structure
 
Discovering Resume Information using linked data  
Discovering Resume Information using linked data  Discovering Resume Information using linked data  
Discovering Resume Information using linked data  
 
Timeline SoMa WADE
Timeline SoMa WADETimeline SoMa WADE
Timeline SoMa WADE
 
Application layer
Application layer Application layer
Application layer
 
p2p project report
p2p project reportp2p project report
p2p project report
 
Wade.Semantic User Profiles
Wade.Semantic User ProfilesWade.Semantic User Profiles
Wade.Semantic User Profiles
 
Docparser integration with odoo erp
Docparser integration with odoo erpDocparser integration with odoo erp
Docparser integration with odoo erp
 
Privacy Threshold Analysis
Privacy Threshold AnalysisPrivacy Threshold Analysis
Privacy Threshold Analysis
 
1. Create and call a function to � Open a text file for storing the.pdf
1. Create and call a function to � Open a text file for storing the.pdf1. Create and call a function to � Open a text file for storing the.pdf
1. Create and call a function to � Open a text file for storing the.pdf
 
OData, Open Data Protocol. A brief introduction
OData, Open Data Protocol. A brief introductionOData, Open Data Protocol. A brief introduction
OData, Open Data Protocol. A brief introduction
 
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
 
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docxCopyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
 
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External SourcesTERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
 
Bba203 unit 2data processing concepts
Bba203   unit 2data processing conceptsBba203   unit 2data processing concepts
Bba203 unit 2data processing concepts
 
17 define workforce records
17   define workforce records17   define workforce records
17 define workforce records
 

Mais de 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
 
Data management
Data managementData management
Data management
 
Android sq lite database tutorial
Android sq lite database tutorialAndroid sq lite database tutorial
Android sq lite database tutorial
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Último (20)

Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

Content provider

  • 1. 1. ContentProvider used to get data from central repository. 2. Android application contains content provider to provide data to other applications. 3. you can also create your custom content provider to get data from database / sdcard / media etc
  • 2.
  • 3.
  • 4. Content URIs To query a content provider, you specify the query string in the form of a URI which has following format − <prefix>://<authority>/<data_type>/<id> Sr.No Part & Description 1 prefix This is always set to content:// 2 authority This specifies the name of the content provider, for example contacts, browser etc. For third-party content providers, this could be the fully qualified name, such as com.tutorialspoint.statusprovider 3 data_type This indicates the type of data that this particular provider provides. For example, if you are getting all the contacts from the Contactscontent provider, then the data path would be people and URI would look like thiscontent://contacts/people 4 id This specifies the specific record requested. For example, if you are looking for contact number 5 in the Contacts content provider then URI would look like this content://contacts/people/5.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. // A "projection" defines the columns that will be returned for each row String[] mProjection= { ContactsContract.Contacts._ID, // Contract class constant for the _ID column name ContactsContract.Contacts.DISPLAY_NAME // Contract class constant for the DISPLAY_NAME column name };