Four Building Blocks of Android

Lets talk about the four fundamental building blocks from which all the android applications are built. These building blocks are implemented as Java classes.

Android Component

Here is a diagrammatic representation of android application fundamental which explores android components and other fundamentals by Romain Chaippinelli.

application fundamental

 

 

 

 

 

 

Lets understand the four building blocks

Activity

Anything that is visible to the user has an activity. Basically, activity is the primary class which is defined to present the graphical user interface to the user and capture user’s interaction through that interface. An activity should support a single focused thing that the user can do. eg: any UI visible in the app.

Services

Unlike activities, services don’t require any user interface and runs in the background thread. We basically place long running operations in services. They provide a way for different processes to request operations and share data. eg: music application, while we play a song, it is still playing in the background even though the app is closed.

Broadcast Receiver

Broadcast receivers are the fundamental components that listens to and responds to events. Broadcast receiver acts as a subscriber that listens to its required Intents and respond to it. eg: messaging app which shows a notification when a message is received.

Content Provider

If an application manages data and needs to expose that data to other applications, we use Content Providers. Content Providers allows applications to store and share data. If an application needs to access data from another application this is done through Content Provider of that application. The access might be read or write or both operations. Similarly, content provider is used to provide data to the same containing application as well. Thus, we can say content provider is a database style component that handles interprocess communication between applications. eg: messaging app which can explore our contacts through contacts application.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s