You are on page 1of 9

Android Components and

Dalvik Virtual Machine


Android Components:
Android Application Development shall have four major
components:

1. Activity / Activities
2. Service / Services
3. Broadcast Receivers
4. Content Providers
Android Components (Continued….):
1. Activity / Activities:
• It is a user interface. It contains both front-end/UI and back-
end/UX definition.
• In android front end definition is define by using XML
definition and back end definition or business logic is define
by using Java or Koltin.
E.g.:
public class MainActivity extends Activity
{
-----
}
Android Components (Continued….):
2. Service / Services:
• It is a service component that runs in the background to perform
long-running operations.
• It contains only back-end/UX definition and does not contains
front-end/UI details.
E.g.:
public class MyService extends Service
{
-----
}
Android Components (Continued….):
3. Broadcast Receivers:
• It will receive a response then after only it broadcast the
messages or doing some action from other applications or
from the system.
E.g.: Call Receiver, SMS Receiver, Notification, Radio etc
public class MyReceiver extends BroadcastReceiver
{
-----
}
Android Components (Continued….):
4. Content Providers:
• A content provider component supplies data from one
application to others on request.
• Such request are handled by the methods of the
ContentResolver class.
E.g.:
public class MyContentProvider extends ContentProvider
{
-----
}
Android Components (Continued….):
• Now's let's we see the one E.g. of android component's through
“Alarm” App
– Activity: It is a UI where we can set alarm.
– Content Provider: User Alarm data is saved at some place.
– Service: After user set a Alarm then there is a background
service or process is created which is continuously monitor to
the time interval to check whether current time interval is
match to the alarm time interval to fire an event.
– Broadcast Receiver: Broadcast Receiver receives a
response to handle the event at that interval. So that during
that alarm time we receives the notification, popup sound,
etc.
Dalvik Virtual Machine:
Dalvik Virtual Machine (Continued….):

You might also like