SlideShare a Scribd company logo
1 of 21
Android Application Components
Broadcast Receivers & Content
Providers
Broadcast Receivers
Simply respond to broadcast messages from
other applications or from the system itself.
These messages are sometime called events
or intents.
Eg.
Applications can also initiate broadcasts to let
other applications know that some data has
been downloaded to the device
(Cont.,)
Two important steps to make BroadcastReceiver
works for the system broadcasted intents −
• Creating the Broadcast Receiver.
• Registering Broadcast Receiver
Creating the Broadcast Receiver
• A broadcast receiver is implemented as a
subclass of BroadcastReceiver class and
overriding the onReceive() method where
each message is received as a Intent object
parameter.
MyReceiver.java
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show();
}
}
Registering Broadcast Receiver
An application listens for specific broadcast
intents by registering a broadcast receiver
inAndroidManifest.xml file.
AndroidManifest.xml file (Cont.,)
<application android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name="MyReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>
</application>
whenever your Android device gets booted, it will be intercepted by
BroadcastReceiverMyReceiver and implemented logic
inside onReceive() will be executed.
(Cont.,)
There are several system generated events
defined as final static fields in the Intent class.
Eg.
android.intent.action.BATTERY_LOW
• Indicates low battery condition on the device.
android.intent.action.REBOOT
• device reboot.
Broadcasting Custom Intents
Your application itself should generate and
send custom intents by creating and sending
those intents using sendBroadcast() method
inside your activity class.
How to create BroadcastReceiver to
intercept custom intent
Step Description
1 Modify main activity file MainActivity.java to
add broadcastIntent() method.
2 Create a new java file called MyReceiver.java under the
packagecom.example. myapplication to define a BroadcastReceiver.
3 An application can handle one or more custom and system intents without
any restrictions. Every intent you want to intercept must be registered in
yourAndroidManifest.xml file using <receiver.../> tag
4 Modify the default content of res/layout/activity_main.xml file to include
a button to broadcast intent.
5 No need to modify the string file, Android studio take care of string.xml
file.
6 Run the application to launch Android emulator and verify the result of
the changes done in the application.
(Cont.,)
MainActivity.java
public void broadcastIntent(View view) {
Intent intent = new Intent();
intent.setAction(“CUSTOM_INTENT");
sendBroadcast(intent); }
(Cont.,)
(Cont.,)
(Cont.,)
Let's click on Broadcast Intent button, this will
broadcast our custom
intent ”CUSTOM_INTENT" which will be
intercepted by our registered
BroadcastReceiver .
Content Providers
A content provider component supplies data
from one application to others on request.
Such requests are handled by the methods of
the ContentResolver class.
A content provider behaves very much like a
database where you can query it, edit its
content, as well as add or delete content using
insert(), update(), delete(), and query()
methods. In most cases this data is stored in
an SQlite database.
(Cont.,)
Cont.,
A content provider is implemented as a
subclass of ContentProvider class and must
implement a standard set of APIs that enable
other applications to perform transactions.
public class My Application extends
ContentProvider
{
}
Content URI
• 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>
Cont.,
• First of all you need to create a Content Provider class
that extends the ContentProviderbaseclass.
• Second, you need to define your content provider URI
address which will be used to access the content.
• Next you will need to create your own database to keep
the content. Usually, Android uses SQLite database and
framework needs to override onCreate() method which
will use SQLite Open Helper method to create or open
the provider's database. When your application is
launched, the onCreate() handler of each of its Content
Providers is called on the main application thread.
• Next you will have to implement Content Provider
queries to perform different database specific
operations.
• Finally register your Content Provider in your activity file
using <provider> tag.
Cont.,
Cont.,
• onCreate() This method is called when the provider is
started.
• query() This method receives a request from a client.
The result is returned as a Cursor object.
• insert()This method inserts a new record into the
content provider.
• delete() This method deletes an existing record from
the content provider.
• update() This method updates an existing record from
the content provider.
• getType() This method returns the MIME type of the
data at the given URI.
Example
Step Description
1
You will use Android StudioIDE to create an Android application and name it
as My Application under a package com.example.MyApplication, with blank
Activity.
2
Modify main activity file MainActivity.java to add two new methods
onClickAddName() and onClickRetrieveStudents().
3
Create a new java file called StudentsProvider.java under the package
com.example.MyApplication to define your actual provider and associated
methods.
4
Register your content provider in your AndroidManifest.xml file using
<provider.../> tag
5
Modify the default content of res/layout/activity_main.xml file to include a
small GUI to add students records.

More Related Content

Similar to Android Application Components-BroadcastReceiver_Content Provider.pptx

Android App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsAndroid App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsDiego Grancini
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbitCarWash1
 
BroadcastReceivers in Android
BroadcastReceivers in AndroidBroadcastReceivers in Android
BroadcastReceivers in AndroidPerfect APK
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptBirukMarkos
 
android content providers
android content providersandroid content providers
android content providersDeepa Rani
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android OKirill Rozov
 
"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3Tadas Jurelevičius
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Android App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsAndroid App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsDiego Grancini
 
Mobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfMobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfAbdullahMunir32
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
Advance Android application development workshop day 3
Advance Android application development workshop day 3Advance Android application development workshop day 3
Advance Android application development workshop day 3cresco
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidgetKrazy Koder
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in androidOum Saokosal
 

Similar to Android Application Components-BroadcastReceiver_Content Provider.pptx (20)

Best android classes in mumbai
Best android classes in mumbaiBest android classes in mumbai
Best android classes in mumbai
 
Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
 
Android App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsAndroid App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgets
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbit
 
BroadcastReceivers in Android
BroadcastReceivers in AndroidBroadcastReceivers in Android
BroadcastReceivers in Android
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
 
android content providers
android content providersandroid content providers
android content providers
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android O
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Android App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsAndroid App Development - 14 location, media and notifications
Android App Development - 14 location, media and notifications
 
Mobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdfMobile Application Development-Lecture 13 & 14.pdf
Mobile Application Development-Lecture 13 & 14.pdf
 
Level 4
Level 4Level 4
Level 4
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
Advance Android application development workshop day 3
Advance Android application development workshop day 3Advance Android application development workshop day 3
Advance Android application development workshop day 3
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in android
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
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 communicationnomboosow
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
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
 

Android Application Components-BroadcastReceiver_Content Provider.pptx

  • 1. Android Application Components Broadcast Receivers & Content Providers
  • 2. Broadcast Receivers Simply respond to broadcast messages from other applications or from the system itself. These messages are sometime called events or intents. Eg. Applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device
  • 3. (Cont.,) Two important steps to make BroadcastReceiver works for the system broadcasted intents − • Creating the Broadcast Receiver. • Registering Broadcast Receiver
  • 4. Creating the Broadcast Receiver • A broadcast receiver is implemented as a subclass of BroadcastReceiver class and overriding the onReceive() method where each message is received as a Intent object parameter. MyReceiver.java public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show(); } }
  • 5. Registering Broadcast Receiver An application listens for specific broadcast intents by registering a broadcast receiver inAndroidManifest.xml file.
  • 6. AndroidManifest.xml file (Cont.,) <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name="MyReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"> </action> </intent-filter> </receiver> </application> whenever your Android device gets booted, it will be intercepted by BroadcastReceiverMyReceiver and implemented logic inside onReceive() will be executed.
  • 7. (Cont.,) There are several system generated events defined as final static fields in the Intent class. Eg. android.intent.action.BATTERY_LOW • Indicates low battery condition on the device. android.intent.action.REBOOT • device reboot.
  • 8. Broadcasting Custom Intents Your application itself should generate and send custom intents by creating and sending those intents using sendBroadcast() method inside your activity class.
  • 9. How to create BroadcastReceiver to intercept custom intent Step Description 1 Modify main activity file MainActivity.java to add broadcastIntent() method. 2 Create a new java file called MyReceiver.java under the packagecom.example. myapplication to define a BroadcastReceiver. 3 An application can handle one or more custom and system intents without any restrictions. Every intent you want to intercept must be registered in yourAndroidManifest.xml file using <receiver.../> tag 4 Modify the default content of res/layout/activity_main.xml file to include a button to broadcast intent. 5 No need to modify the string file, Android studio take care of string.xml file. 6 Run the application to launch Android emulator and verify the result of the changes done in the application.
  • 10. (Cont.,) MainActivity.java public void broadcastIntent(View view) { Intent intent = new Intent(); intent.setAction(“CUSTOM_INTENT"); sendBroadcast(intent); }
  • 13. (Cont.,) Let's click on Broadcast Intent button, this will broadcast our custom intent ”CUSTOM_INTENT" which will be intercepted by our registered BroadcastReceiver .
  • 14. Content Providers A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ContentResolver class. A content provider behaves very much like a database where you can query it, edit its content, as well as add or delete content using insert(), update(), delete(), and query() methods. In most cases this data is stored in an SQlite database.
  • 16. Cont., A content provider is implemented as a subclass of ContentProvider class and must implement a standard set of APIs that enable other applications to perform transactions. public class My Application extends ContentProvider { }
  • 17. Content URI • 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>
  • 18. Cont., • First of all you need to create a Content Provider class that extends the ContentProviderbaseclass. • Second, you need to define your content provider URI address which will be used to access the content. • Next you will need to create your own database to keep the content. Usually, Android uses SQLite database and framework needs to override onCreate() method which will use SQLite Open Helper method to create or open the provider's database. When your application is launched, the onCreate() handler of each of its Content Providers is called on the main application thread. • Next you will have to implement Content Provider queries to perform different database specific operations. • Finally register your Content Provider in your activity file using <provider> tag.
  • 20. Cont., • onCreate() This method is called when the provider is started. • query() This method receives a request from a client. The result is returned as a Cursor object. • insert()This method inserts a new record into the content provider. • delete() This method deletes an existing record from the content provider. • update() This method updates an existing record from the content provider. • getType() This method returns the MIME type of the data at the given URI.
  • 21. Example Step Description 1 You will use Android StudioIDE to create an Android application and name it as My Application under a package com.example.MyApplication, with blank Activity. 2 Modify main activity file MainActivity.java to add two new methods onClickAddName() and onClickRetrieveStudents(). 3 Create a new java file called StudentsProvider.java under the package com.example.MyApplication to define your actual provider and associated methods. 4 Register your content provider in your AndroidManifest.xml file using <provider.../> tag 5 Modify the default content of res/layout/activity_main.xml file to include a small GUI to add students records.