{"id":81419,"date":"2021-06-30T09:00:58","date_gmt":"2021-06-30T03:30:58","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=81419"},"modified":"2024-08-03T13:03:39","modified_gmt":"2024-08-03T07:33:39","slug":"content-provider-in-android","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/","title":{"rendered":"Content Provider in Android"},"content":{"rendered":"<p><strong>\u201cDid you ever imagine how applications share data?\u201d<\/strong><\/p>\n<p>Did you ever imagine how you could upload your picture on any application? Actually, for this, you open your application and your application seeks your permission to access the gallery. Then you select your image and upload it.<\/p>\n<p>All kinds of data sharing among the applications are available due to the content provider.<\/p>\n<p>This article will help you understand what a content provider is and why it is used in Android Development. You will get to know the crud operations and about SQLite Database. Further, we will discuss the methods involved and show you an implementation of the concept.<\/p>\n<h3>What are Android Content Providers?<\/h3>\n<p>Content Providers act as a medium for various applications to communicate with each other. It manages and looks over the application data and accesses the SQLite Database.<\/p>\n<p>However, it provides only exclusive data to the application user and does not allow you to access the other application data until granted.<br \/>\nAll the seeking of data is done through the content provider itself. Whenever you require access to data from other applications, the content provider seeks permission from the user to access the data to the other application.<\/p>\n<p>One typical example which you often notice is your gallery. Whenever any application needs to access some pictures from the gallery, it seeks your permission, and the content provider provides you with the required content.<\/p>\n<p>Another ubiquitous example is your payments application, which accesses your contacts to show the people with whom you can exchange money.<\/p>\n<p><strong>Examples of Content Providers<\/strong><\/p>\n<p>There are various examples of content providers in Android. Some of them are as follows:<\/p>\n<ul>\n<li>Music Playlist<\/li>\n<li>Calls Logs<\/li>\n<li>Contact List<\/li>\n<li>Message Threads<\/li>\n<li>Gallery Application<\/li>\n<li>File Manager, etc<\/li>\n<\/ul>\n<h3>About SQLite Database<\/h3>\n<p>It is a scrapped-out (or lower version) of SQL. Whatever libraries you call or whatever read\/write or file operations you make are done through SQLite.<\/p>\n<p>It is a relational database management system and has a syntax similar to PostgreSQL.<br \/>\nUser data is usually stored in SQLite Database inside the user\u2019s device. We can perform several read, write, update, delete operations on the data.<\/p>\n<p>The SQLite database doesn\u2019t require an internet connection to connect you to the database.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/SQLite-Database.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81565\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/SQLite-Database.jpg\" alt=\"SQLite Database\" width=\"864\" height=\"507\" \/><\/a><\/p>\n<h3>CRUD Operations<\/h3>\n<p>Following are the operations that are usually performed on any data. We term them as the CRUD operations.<\/p>\n<h4>CREATE<br \/>\nREAD<br \/>\nUPDATE<br \/>\nDELETE<\/h4>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/CRUD-Operations.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81564\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/CRUD-Operations.jpg\" alt=\"CRUD Operations in Android\" width=\"821\" height=\"376\" \/><\/a><\/p>\n<p>Let\u2019s see in detail what each operation does:<\/p>\n<h4>CREATE:<\/h4>\n<p>You can use the operation to create data in the database. This involves adding new records or entries, such as a new user or product. Typically, this operation includes specifying the details or attributes of the new record to be stored.<\/p>\n<h4>READ:<\/h4>\n<p>Using this operation, you can access your data stored in the database. You can only read the data and can\u2019t alter it. This is essential for retrieving information like displaying user profiles or product details without making any modifications.<\/p>\n<h4>UPDATE:<\/h4>\n<p>Using this operation, you can alter the stored data in your database. This is used to modify existing records, such as updating a user&#8217;s email address or changing the price of a product. The operation ensures that the data remains accurate and up-to-date.<\/p>\n<h4>DELETE:<\/h4>\n<p>Using this operation, you can delete the stored data from your database. This is useful for removing outdated or unnecessary records, such as deleting an inactive user account or removing discontinued products, thereby maintaining database cleanliness.<\/p>\n<h3>Working of Content Provider in Android<\/h3>\n<p>We know that the Content Provider provides us data, but we need to establish a connection to get this data. The link is made using the \u201cContentResolver\u201d object. The ContentResolver objects help the application to communicate with the Content Provider.<\/p>\n<p>Now, in the next step, we need to connect our ContentResolver object with the user interface. By this step, the user can interact directly with the Content Provider by using the user interface. For this purpose, we require another object called CursorLoader.<\/p>\n<p>The CursorLoader task is to receive the user\u2019s query request and forward it to the Content Provider. The content Provider executes the query and provides the user the requested data.<\/p>\n<p>The diagram below describes the working of the Content Provider.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Working-of-Content-Provider.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81563\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Working-of-Content-Provider.jpg\" alt=\"Working of Content Provider in Android\" width=\"518\" height=\"754\" \/><\/a><\/p>\n<h3>Methods of Content Provider in Android<\/h3>\n<p>Six methods are used while implementing the Content Provider. Following are the methods:<\/p>\n<h4>1. onCreate()<\/h4>\n<p>This method is called to initialize the provider whenever a content provider is created. It is used to set up any required resources, such as database connections or file storage. Typically, this method ensures that the provider is ready to handle requests for data access.<\/p>\n<h4>2. query()<\/h4>\n<p>The query method takes parameters to fetch data from the database. The data is accessed through a cursor object. This method allows you to specify which columns to retrieve, conditions for filtering rows, sorting orders, and more, making it versatile for different data retrieval needs.<\/p>\n<h4>3. insert()<\/h4>\n<p>This method is used to insert a row in the database. It takes a URI and a set of values as parameters and returns the URI of the newly inserted row. This method ensures that new data entries are added correctly to the specified database table.<\/p>\n<h4>4. update()<\/h4>\n<p>This method is used to alter the data fields present in the database. It takes a URI, a set of values to update, and a selection criteria to specify which rows to update. This method is essential for modifying existing data in a controlled manner.<\/p>\n<h4>5. delete()<\/h4>\n<p>This method is used to delete records from the database. It takes a URI and a selection criteria to specify which rows to delete. This method helps in removing data entries that are no longer needed, maintaining the integrity of the database.<\/p>\n<h4>6. getType()<\/h4>\n<p>It returns the MIME(Multipurpose Internet Mail Extension) type of the data, which can be used as the content URI. This method helps in determining the type of data returned, which is useful for clients to understand the format and handle the data appropriately.<\/p>\n<h3>Content URIs in Android<\/h3>\n<p>Content URIs are the query string that is passed to the Content Provider. URI means Uniform Resource Identifier. Content URI\u2019s are used to identify the various types of data in the Content Provider. Based on the Content URI, we get the required data.<\/p>\n<p>The structure of any Content URI can be divided into four types:<\/p>\n<ul>\n<li><strong>Prefix<\/strong> -Usually, the prefix is set to content:\/\/.<\/li>\n<li><strong>Authority<\/strong> &#8211; It contains the name of the Provider.<\/li>\n<li><strong>Path<\/strong> &#8211; It contains the location of the data.<\/li>\n<li><strong>ID<\/strong> &#8211; This is an optional parameter that is used to access specific records.<\/li>\n<\/ul>\n<p>Any Content URI will look as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">content:\/\/&lt;authority&gt;\/&lt;path&gt;\/&lt;optional_id&gt;\r\n<\/pre>\n<h3>Implementation of Content Provider in Android<\/h3>\n<p>Following are the steps using which you can implement Content Provider in Android. We will show you how to create an application that can fetch all your contacts and display them in a list format.<\/p>\n<p><strong>1:<\/strong> Open your Android Studio.<\/p>\n<p><strong>2:<\/strong> Click on Create New Project<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81567\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App1.png\" alt=\"Android Content Provider\" width=\"1852\" height=\"1048\" \/><\/a><\/p>\n<p><strong>3: <\/strong>Select Empty Activity and proceed.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81568\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App2.png\" alt=\"Android Activity\" width=\"1848\" height=\"1048\" \/><\/a><\/p>\n<p><strong>4: <\/strong>Enter your application name. In my case, it\u2019s \u201cTechVidvanBroadcast.\u201d Next, select Kotlin from the dropdown. For the API level, select API 22 for now.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81569\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Content_provider_App3.png\" alt=\"Android API\" width=\"1854\" height=\"1048\" \/><\/a><\/p>\n<p><strong>5: <\/strong>Now go to your manifest file and add permission to read contacts. You can copy the below code for your reference.<\/p>\n<p><strong>Code: (AndroidManifest.xml)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    package=\"com.example.techvidvancontentprovider\"&gt;\r\n\r\n    &lt;uses-permission android:name=\"android.permission.READ_CONTACTS\"\/&gt;\r\n\r\n    &lt;application\r\n        android:allowBackup=\"true\"\r\n        android:icon=\"@mipmap\/ic_launcher\"\r\n        android:label=\"@string\/app_name\"\r\n        android:roundIcon=\"@mipmap\/ic_launcher_round\"\r\n        android:supportsRtl=\"true\"\r\n        android:theme=\"@style\/Theme.TechVidvanContentProvider\"&gt;\r\n        &lt;activity android:name=\".MainActivity\"&gt;\r\n            &lt;intent-filter&gt;\r\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\r\n\r\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\r\n            &lt;\/intent-filter&gt;\r\n        &lt;\/activity&gt;\r\n    &lt;\/application&gt;\r\n\r\n&lt;\/manifest&gt;\r\n<\/pre>\n<p><strong>6: <\/strong>Now go to the app &#8211;&gt; res &#8211;&gt; layout &#8211;&gt; activity_main.xml and add a list view to display the contacts. You can copy the activity_main.xml code from below.<\/p>\n<p><strong>Code: (activity_main.xml)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.constraintlayout.widget.ConstraintLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".MainActivity\"&gt;\r\n\r\n    &lt;TextView\r\n        android:id=\"@+id\/title\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_margin=\"20dp\"\r\n        android:gravity=\"center\"\r\n        android:text=\"TechVidvan\"\r\n        android:textColor=\"@color\/teal_700\"\r\n        android:textSize=\"40sp\"\r\n        android:textStyle=\"bold\"\r\n        app:layout_constraintVertical_bias=\".02\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintEnd_toEndOf=\"parent\"\r\n        app:layout_constraintStart_toStartOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\r\n\r\n    &lt;ListView\r\n        android:id=\"@+id\/contact_list_view\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_margin=\"15dp\"\r\n        app:layout_constraintVertical_bias=\"0.15\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintEnd_toEndOf=\"parent\"\r\n        app:layout_constraintStart_toStartOf=\"parent\"\r\n        app:layout_constraintTop_toBottomOf=\"@+id\/title\" \/&gt;\r\n\r\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\r\n<\/pre>\n<p><strong>7: <\/strong>After coding the activity_main.xml, come to the MainActivity.kt file and paste the below code. Here, you can find that we have overridden the onCreate() method to initialize the content provider.Further, we have used a content resolver object to read the contacts.<\/p>\n<p>You can find comments in the code for your understanding.<\/p>\n<p><strong>Code: (MainActivity.kt) <\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.example.techvidvancontentprovider\r\n\r\nimport android.content.pm.PackageManager\r\nimport android.os.Bundle\r\nimport android.provider.ContactsContract\r\nimport android.widget.ListView\r\nimport android.widget.SimpleCursorAdapter\r\nimport androidx.appcompat.app.AppCompatActivity\r\nimport androidx.core.app.ActivityCompat\r\n\r\nclass MainActivity : AppCompatActivity()\r\n{\r\n    \/\/this variable stores the contact details\r\n    \/\/in the form of an array\r\n    var contact_fields = listOf&lt;String&gt;(\r\n        ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,\r\n        ContactsContract.CommonDataKinds.Phone.NUMBER,\r\n        ContactsContract.CommonDataKinds.Phone._ID\r\n\r\n    ).toTypedArray()\r\n\r\n    \/\/using listview to show your contacts in list form\r\n    lateinit var list_view:ListView;\r\n\r\n    override fun onCreate(savedInstanceState: Bundle?)\r\n    {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_main)\r\n\r\n        \/\/Binding ListView to a variable\r\n        \/\/to display the contact list\r\n\r\n        list_view = findViewById(R.id.contact_list_view);\r\n\r\n        \/\/Checking if the user has granted\r\n        \/\/permission to access his contacts or not\r\n\r\n        if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_CONTACTS) !=\r\n            PackageManager.PERMISSION_GRANTED)\r\n        {\r\n            \/\/If permission not granted\r\n            \/\/then seek permission from user\r\n\r\n            ActivityCompat.requestPermissions(this,\r\n                Array(1){android.Manifest.permission.READ_CONTACTS},\r\n            100)\r\n        }\r\n        else\r\n        {\r\n            \/\/if permission granted then access user contacts\r\n            readUserContacts();\r\n        }\r\n    }\r\n\r\n    override fun onRequestPermissionsResult(\r\n        requestCode: Int,\r\n        permissions: Array&lt;out String&gt;,\r\n        grantResults: IntArray\r\n    )\r\n    {\r\n        \/\/This function is called\r\n        super.onRequestPermissionsResult(requestCode, permissions, grantResults)\r\n\r\n        if(requestCode == 100 &amp;&amp; grantResults[0]==PackageManager.PERMISSION_GRANTED)\r\n        {\r\n            \/\/if permission granted\r\n            \/\/then display contacts\r\n            readUserContacts()\r\n        }\r\n    }\r\n    private fun readUserContacts()\r\n    {\r\n        var source = listOf&lt;String&gt;(\r\n            ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,\r\n            ContactsContract.CommonDataKinds.Phone.NUMBER\r\n\r\n        ).toTypedArray()\r\n\r\n        var destination = intArrayOf(android.R.id.text1, android.R.id.text2)\r\n\r\n        var result_set = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,\r\n        contact_fields, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)\r\n\r\n        var adapter = SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, result_set,\r\n        source, destination, 0);\r\n\r\n        list_view.adapter = adapter\r\n\r\n\r\n\r\n    }\r\n}\r\n<\/pre>\n<p>Now you are ready to test your application. Just run the application on your device or the emulator, and you can notice the following.<\/p>\n<p>Firstly, the app seeks permission to access your contacts.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/contact_app_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81570\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/contact_app_1.png\" alt=\"Android App\" width=\"1016\" height=\"1048\" \/><\/a><\/p>\n<p>After your grant the permission then you can see your contact list like below.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/contact_app_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81571\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/contact_app_2.png\" alt=\"Android Contact App\" width=\"1008\" height=\"1072\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Through this article, you understood what a content provider is and saw several examples of content providers. You got to know what SQLite database is and what CRUD operations are. Further, you came across the working of Content Providers and the various methods involved.<\/p>\n<p>Lastly, you saw what Content URI\u2019s are, and finally, you saw an app using which you can access your contact list.<\/p>\n<p><span style=\"font-weight: 400;\">Now you are ready to test your application. Just run the application on your device or the emulator, and you can notice the following.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cDid you ever imagine how applications share data?\u201d Did you ever imagine how you could upload your picture on any application? Actually, for this, you open your application and your application seeks your permission&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":81562,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2791],"tags":[3654,3655,3656],"class_list":["post-81419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-content-provider","tag-content-provider-in-android","tag-crud-operations"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Content Provider in Android - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn what is content provider in Android and why it is used. Learn about CRUD Operation &amp; implementation of ContentProvider in Android.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Content Provider in Android - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn what is content provider in Android and why it is used. Learn about CRUD Operation &amp; implementation of ContentProvider in Android.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-30T03:30:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-03T07:33:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Content Provider in Android - TechVidvan","description":"Learn what is content provider in Android and why it is used. Learn about CRUD Operation & implementation of ContentProvider in Android.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/","og_locale":"en_US","og_type":"article","og_title":"Content Provider in Android - TechVidvan","og_description":"Learn what is content provider in Android and why it is used. Learn about CRUD Operation & implementation of ContentProvider in Android.","og_url":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-06-30T03:30:58+00:00","article_modified_time":"2024-08-03T07:33:39+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Content Provider in Android","datePublished":"2021-06-30T03:30:58+00:00","dateModified":"2024-08-03T07:33:39+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/"},"wordCount":1438,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg","keywords":["Android Content Provider","Content Provider in Android","CRUD Operations"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/","url":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/","name":"Content Provider in Android - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg","datePublished":"2021-06-30T03:30:58+00:00","dateModified":"2024-08-03T07:33:39+00:00","description":"Learn what is content provider in Android and why it is used. Learn about CRUD Operation & implementation of ContentProvider in Android.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Content-provider-in-android.jpg","width":1200,"height":628,"caption":"Content provider in android"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/content-provider-in-android\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Content Provider in Android"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=81419"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81419\/revisions"}],"predecessor-version":[{"id":447567,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81419\/revisions\/447567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/81562"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=81419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=81419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=81419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}