Android Components – Android development tutorial

Android Components – Android development tutorial

Android components can be mainly categorized in 4 components.

  1. Activity
  2. Service
  3. Content Provider
  4. Broadcast Receiver.

We have to understand all the above basic components in order to build an Android application.

Some other fundamental components are View, Intent, Fragment, AndroidManifest.xml etc.

Let’s see the short description of every component one by one.


An Activity is a User Interface(UI) Android component that usually represents a single screen in your application.  We can say that it performs actions on the screen.

An application can have zero or more activities. Typically, applications have one or more activities.

The main aim of Activity is to interact with the user. From the moment an activity appears on the screen till the time it’s hidden, it goes through a number of stages, known as an activity’s lifecycle. We will

We will discuss Activity Life Cycle later.

We can create our Activity subclass by extends with Activity.

public class MainActivity extends Activity {



Service is an Android component which doesn’t have any UI, it runs in the background. It can update UI elements.

It allows sharing functionality among application without creating the physical copy of the class.

Services are of two types:

  • Bound
  • Unbound.

We can create our Service subclass by extends with Service.

public class DemoService extends Service {


Content Provider

The Content Provider android component provides following features:

  1. Hides database details (database name, table name, column information etc.)
  2. Allows the application to share data among multiple applications.

In Android, it is embedded with SQLite Database where all our data gets stored.

To create the content provider subclass, extend the ContentProvider class.

public class DemoContentProvider extends ContentProvider {

        public void onCreate(){}


BroadCast Receiver

Broadcast Receiver android component is used to receive broadcasted messages sent by the system or other applications.

It allows us to register for system and application events. When the event is started then all the registered receivers are notified by the

The implementing class for a Recer extends the BroadCastReceiver class.

public class DemoReceiver extends BroadCastReceiver 
public void onReceive(context,intent){}