Parts of an Android application

Posted By on March 21, 2016


Download PDF
Simple Android App using Android Studio
Base user interface components in Android

An Android application is a single installable unit which can be started and used independently of other Android applications.

An Android application consists of Android components, Java source and resource files.

Android application components can connect to components of other Android applications based on a task description represented by an Intent object. This way they can create cross-application tasks. The integration of these components can be done in a way that the Android application can still work flawless, even if the additional components are not installed or if different components perform the same task.

Android software components

The following Android components can be defined:

  • Application
  • Activities
  • Services
  • Broadcast receivers (short: receivers)
  • Content providers (short: providers)

Application

An Android application can have one Application class which is instantiated as soon as the application starts and it is the last component which is stopped during application shutdown.

If not explicitly defined, Android creates a default application object for your application.

Activity

An activity is the visual representation of an Android application. An Android application can have several activities.

Activities use Section 14, “Android views – UI Widgets”, Section 15.1, “Using a layout manager” and fragments to create the user interface and to interact with the user. Both elements are described in the next sections.

BroadcastReceiver

A broadcast receiver (receiver) can be registered to listen to system messages and intents. A receiver gets notified by the Android system if the specified event occurs.

For example, you can register a receiver for the event that the Android system finished the boot process. Or you can register for the event that the state of the phone changes, e.g., someone is calling.

Service

A service performs tasks without providing an user interface. They can communicate with other Android components, for example, via broadcast receivers and notify the user via the notification framework in Android.

ContentProvider

A content provider (provider) defines a structured interface to application data. A provider can be used for accessing data within one application, but can also be used to share data with other applications.

Android contains an SQLite database which is frequently used in conjunction with a content provider. The SQLite database would store the data, which would be accessed via the provider.

Context

Instances of the class android.content.Context provide the connection to the Android system which executes theapplication application. It also gives access to the resources of the project and the global information about the application environment.

For example, you can check the size of the current device display via the Context.

The Context class also provides access to Android services, e.g., the alarm manager to trigger time based events.

Activities and services extend the Context class. Therefore, they can be directly used to access the Context.

Simple Android App using Android Studio
Base user interface components in Android

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com