You are here
Home > HelloWorld >

App Components

App components are an entry point through which the system or a user can enter into your app.

Components

There are four different types of app components:

  • Activities
  • Services
  • Broadcast receivers
  • Content providers

1.Activities

Android Activity is Front end view of an app.It represents a single screen with a user interface. For example, an whatsapp app might have one activity that shows a list of all contacts, another activity to show all chats, and another activity to update status. Although the activities work together to form a cohesive user experience in the whatsapp app, each one is independent of the others.

Intent: An Intent is a simple message object that is used to communicate between android components such as activities, content providers, broadcast receivers and services. Intents are also used to transfer data between activities.

Use of Intent:

  1. For Launching an Activity
  2. To start a New Service
  3. For Broadcasting Messages
  4. To Display a list of contacts in List View

2.Services

Android service is a component that is used to perform operations on the background such as playing music, handle network transactions, interacting content providers etc. It does not provide a user interface. For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity.

3.BroadCast Receivers

Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.
Although broadcast receivers don’t display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs.

4.Content Providers

Content provider component supplies data from one application to others on request. This component is useful for reading and writing data that is private to your app and not shared.

Leave a Reply

Top
%d bloggers like this: