0% found this document useful (0 votes)
89 views6 pages

Module 3: Android Application Components: Gordon College

The document discusses the core components of an Android application. It defines an Android application as software running on the Android platform, originally intended for productivity but now covering many areas. The four main components are activities, services, broadcast receivers, and content providers. [1] Activities manage the user interface and display single screens like composing an email. [2] Services perform background tasks like playing music. [3] Broadcast receivers allow communication between apps and the system for things like low battery alerts. [4] Content providers allow sharing and querying of app data stored in various sources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views6 pages

Module 3: Android Application Components: Gordon College

The document discusses the core components of an Android application. It defines an Android application as software running on the Android platform, originally intended for productivity but now covering many areas. The four main components are activities, services, broadcast receivers, and content providers. [1] Activities manage the user interface and display single screens like composing an email. [2] Services perform background tasks like playing music. [3] Broadcast receivers allow communication between apps and the system for things like low battery alerts. [4] Content providers allow sharing and querying of app data stored in various sources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Republic of the Philippines

City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

Module 3: Android Application Components


I. INTRODUCTION
Android OS was introduced in our previous modules, and we defined it as the
system where android application runs. Different components that comprises its
architecture were also discussed, Module 2 enumerate each one of them and stated
their functions.

In Module 3, we will give a formal definition on the term Android application, its
fundamental building blocks, and how they work within our devices.

II. LEARNING OBJECTIVES


After the completion of this module, the students are expected to;
• Define Android application
• Understand the core application components of an Android application
• Identify the functionality of each components of Android application

III. TOPICS AND KEY CONCEPTS


A. Android Application
An Android application is software running on the Android platform. Because
the Android platform is built for mobile devices, a typical Android app is
designed for a smartphone or a tablet PC running on the Android OS.

Android applications were originally intended for productivity assistance such as


email, calendar, and contract databases, but the public demand for apps caused
rapid expansion into other areas such as mobile games, factory automation,
GPS and location-based services, order-tracking, and ticket purchases, this is
the main reason why there are now millions of apps available.

B. Components of Android Application


The following are the four main components that can be used within Android
application;
• Activities – they manage the UI and handle the user interaction to the
smart phone screen. An activity is a class that represents a single screen,
it can be compared to a Form in Windows application, web page in a web
application or Frame in AWT.

• Services – They handle background processing associated with an


application. Service is a background process that can run for a long time.
There are two types of services local and remote.

• Broadcast Receivers – They control communication between Android OS


and applications
• Content Providers – They manage data and database management
issues. This is also used to share data between the applications.

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 1 of 6
Republic of the Philippines
City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

C. Activities
An activity represents a single screen with a user interface,in-short Activity
performs actions on the screen. For example, an email application might have
one activity that shows a list of new emails, another activity to compose an
email, and another activity for reading emails. If an application has more than
one activity, then one of them should be marked as the activity that is presented
when the application is launched.

An activity is implemented as a subclass of Activity class as follows –

public class MainActivity extends Activity {


}

In android, Activity represents a single screen with a user interface (UI) and it
will acts an entry point for the user’s to interact with app.

For example, a contacts app that is having multiple activities like showing a list
of contacts, add a new contact, and another activity to search for the contacts.
All these activities in the contact app are independent of each other but will
work together to provide a better user experience.

D. Services
A service is a component that runs in the background to perform long-running
operations. For example, a service might play music in the background while the
user is in a different application, or it might fetch data over the network without
blocking user interaction with an activity.

A service is implemented as a subclass of Service class as follows –

public class MyService extends Service {


}
In android, Service is a component that keeps an app running in the
background to perform long-running operations based on our requirements. For
Service, we don’t have any user interface and it will run the apps in background
like play music in background when the user in different app.

We have two types of services available in android, those are


• Local Services
• Remote Services

E. Broadcast Receivers
In android, Broadcast Receiver is a component that will allow a system to deliver
events to the app like sending a low battery message to the app. The apps can
also initiate broadcasts to let other apps know that required data available in a
device to use it.

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 2 of 6
Republic of the Philippines
City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

Generally, we use Intents to deliver broadcast events to other apps and


Broadcast Receivers use status bar notifications to let the user know that
broadcast event occurs.

Broadcast Receivers simply respond to broadcast messages from other


applications or from the system. For example, applications can also initiate
broadcasts to let other applications know that some data has been downloaded
to the device and is available for them to use, so this is broadcast receiver who
will intercept this communication and will initiate appropriate action.

A broadcast receiver is implemented as a subclass of BroadcastReceiver class


and each message is broadcaster as an Intent object.

public class MyReceiver extends BroadcastReceiver {


public void onReceive(context,intent){}
}

F. Content Providers
In android, Content Providers are useful to exchange the data between the apps
based on the requests. The Content Providers can share the app data that stores
in the file system, SQLite database, on the web or any other storage location that
our app can access.

By using Content Providers, other apps can query or modify the data of our app
based on the permissions provided by content provider. For example, android
provides a Content Provider (ContactsContract.Data) to manage contacts
information, by using proper permissions any app can query the content
provider to perform read and write operations on contacts information.

A content provider component supplies data from one application to others on


request. Such requests are handled by the methods of the ContentResolver
class. The data may be stored in the file system, the database or somewhere else
entirely.

A content provider is implemented as a subclass of ContentProvider class and


must implement a standard set of APIs that enable other applications to perform
transactions.

public class MyContentProvider extends ContentProvider {


public void onCreate(){}
}

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 3 of 6
Republic of the Philippines
City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

G. Additional Components of Android Application


There are additional components which will be used in the construction of above
mentioned entities, their logic, and wiring between them. These components are;

No. Components & Description

1 Fragments
Represents a portion of user interface in an Activity.

Views
2
UI elements that are drawn on-screen including buttons, lists forms etc.

Layouts
3
View hierarchies that control screen format and appearance of the views.

Intents
4
Messages wiring components together.

Resources
5
External elements, such as strings, constants and drawable pictures.

Manifest
6
Configuration file for the application.

H. Summary
Module 3 entitled Android Application Components gives a head start about the
different important elements that the student must identified in order to
understand how Android application works.

For example, user interface and interaction between the user and the device can
be established with the used of Activity. Submitting one value from one activity
to another can be accomplished using Intent.

This understanding will help the students for better designing and implementing
functionalities on their respective Android application.

These components will be discussed in detail on the upcoming Modules.

IV. TEACHING AND LEARNING MATERIALS RESOURCE


Materials are being taken from the following;
• Online Resources

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 4 of 6
Republic of the Philippines
City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

V. LEARNING TASK

Instruction: Answer the following questions briefly, your


answer will be evaluated using the following rubric.

Holistic Rubric
Exceeding Meeting Approaching Below None
(10) (8) (6) (2) (0)
Substantial,
Content Clarity
specific, and/or
The presence of ideas Sufficient
illustrative
developed through developed Limited content Superficial
content No content
facts, examples, content with with inadequate and/or
demonstrating or answer
illustrations, details, adequate elaboration or minimal
strong provided.
opinions, statistics, elaboration or explanation content
development and
reasons, and/or explanation.
sophisticated
explanations.
ideas.

1. What are the commands that you can use in creating and loading an Activity
within your Android application?
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________

2. What types of values can we store and share using Intent? How do we save these
values from the source? How do we pass it to its destination activity or
application?
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________

3. What do you think is the best layout that you can use in creating an Android
application? Explain why and make a comparison from other layouts available
in Android Studio.
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________

Score Sheet
Question 1 Question 2 Question 3 Total Score

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 5 of 6
Republic of the Philippines
City of Olongapo
-o0o-
GORDON COLLEGE
Olongapo City Sports Complex, Donor St., East Tapinac, Olongapo City 2200
www.gordoncollege.edu.ph

VI. REFERENCES

Online Resources
• https://www.tutorialspoint.com/android/android_application_components.
htm

• https://www.javatpoint.com/android-core-building-
blocks#:~:text=The%20core%20building%20blocks%20or,xml.

• https://www.tutlane.com/tutorial/android/android-application-
components-activities-intents-views-layouts-services

• https://developer.android.com/guide/components/fundamentals

IT Elective II (Lec) NOT FOR SALE, Exclusive for Gordon College Only!
Neil Marc R. Biron, Instructor (1st Semester, AY 2020-2021) | 6 of 6

You might also like