Tutorialspoint examples

Learn java tutorial with examples for beginners online

android application components

Android application components

App components are the crucial element of an Android app. There are four different types of app components:

  • Activities
  • Services
  • Broadcast receivers
  • Content providers


An activity is window of application by which user can interact with application. It represents a single screen with a user interface.
Android Activity is a component which used to create a UI and take action on event performed by user.


1. In Email application we have Inbox, Sent Items, Compose etc.(All are different activity in android app)
2. Tutorial application shown above.

There are two main topic we have discussed till now.
1. Introduction to android
2. Android fundamental

Both have different UI. First page is Android Introduction which can be default page (Main Activity). When user click on next, a new Activity will be created for Android fundamental. From going Activity 1 into background and creating a new activity, here happened so many things which we will discuss in upcoming Tutorial.

So here we have created UI and action we performed on click event to start activity 2.


Android Service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface.

A music player does not require to be foreground while playing songs. So here comes service in role. Since we read that activity is a component by which user can interact with application by UI. But when application go to background there will be no UI and activity will be no longer in use.

In that case we just trigger a service and service will be running as long as music player running.

Broadcast receivers:

As name define, a broadcast receiver work on publish and subscribe pattern. System and application events can publish signal or message, All the registered receivers will be notified by android runtime. For example, a broadcast announcing that the battery is low, user change mode to airplane, system date change. Apps can also initiate broadcasts. For example to let other apps know that some data has been downloaded to the device and is available for them to use.

Content providers:

By content provider you can store data in the file system, in database(SQLite), on web, or on any other persistent storage which your app can access. Through the content provider, other apps can also access your app data if the content provider allows it. Basically content provider is an interface which use to transfer data from other apps, through network or any persistent technology.

Android Tutorial

Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status