0% found this document useful (0 votes)
29 views

Android Programming - Lecture 2

The document discusses Android fundamentals including Android programming languages, components, structural layout, lifecycle states, and versions. It covers topics like Java, XML, activities, services, broadcast receivers, content providers, manifest, resources, and Gradle files.

Uploaded by

Nishant nyol
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Android Programming - Lecture 2

The document discusses Android fundamentals including Android programming languages, components, structural layout, lifecycle states, and versions. It covers topics like Java, XML, activities, services, broadcast receivers, content providers, manifest, resources, and Gradle files.

Uploaded by

Nishant nyol
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

BCA/B.Sc.

IT (V-Sem)
Course Code: BCI-543
Course Credit: 3

Android Programming
By
Mr. Honey Gocher
PhD. Scholar (Software Engineering)
Amity University Jaipur, Rajasthan
Android Fundamentals
• What is Android
• Android is a mobile operating system based on a modified version of the Linux
kernel and other open-source software, designed primarily for touchscreen
mobile devices such as smartphones and tablets.
• What is Open Source
• What is Linux Kernel
• Core interface between Hardware and Its Processes.
• Limitations
• Lower App Standards
• Lower Security and Vulnerable to data breaches.
• Complex coding structures.
Android Fundamentals
• 1. Android Programming Languages
In Android, basically, programming is done in two languages JAVA or C+
+ and XML(Extension Markup Language).
Nowadays KOTLIN is also preferred.
The XML file deals with the design, presentation, layouts, blueprint, etc (as a
front-end) while the JAVA or KOTLIN deals with the working of buttons,
variables, storing, etc (as a back-end).
Android Fundamentals
• 2. Android Components
The App components are the building blocks of Android. Each component has
its own role and life cycles i.e from launching of an app till the end. Some of
these components depend upon others also. Each component has a definite
purpose. The four major app components are:
Activities
Services
Broadcast Receivers
Content Provider
Android Fundamentals
• Activities: It deals with the UI and the user interactions to the screen. In other words, it
is a User Interface that contains activities. These can be one or more depending upon the
App. It starts when the application is launched. At least one activity is always present
which is known as MainActivity. The activity is implemented through the following.
Syntax:
• public class MainActivity extends Activity{ // processes }
• Services: Services are the background actions performed by the app, these might be
long-running operations like a user playing music while surfing the Internet. A service
might need other sub-services so as to perform specific tasks. The main purpose of the
Services is to provide non-stop working of the app without breaking any interaction with
the user.
Syntax:
• public class MyServices extends Services{ // code for the services }
Android Fundamentals
• Broadcast Receivers: A Broadcast is used to respond to messages from other applications or
from the System. For example, when the battery of the phone is low, then the Android OS fires a
Broadcasting message to launch the Battery Saver function or app, after receiving the message
the appropriate action is taken by the app. Broadcast Receiver is the subclass of
BroadcastReceiver class and each object is represented by Intent objects.
Syntax:
• public class MyReceiver extends BroadcastReceiver{ public void onReceive(context,intent){ }
• Content Provider: Content Provider is used to transferring the data from one application to the
others at the request of the other application. These are handled by the class ContentResolver
class. This class implements a set of APIs(Application Programming Interface) that enables the
other applications to perform the transactions. Any Content Provider must implement the Parent
Class of ContentProvider class.
Syntax:
• public class MyContentProvider extends ContentProvider{ public void onCreate() {} }
Android Fundamentals
• 3. Structural Layout Of Android Studio
Android Fundamentals
• Manifest Folder: Android Manifest is an XML file that is the root of the project
source set. It describes the essential information about the app and the Android build
tools, the Android Operating System, and Google Play. It contains the permission
that an app might need in order to perform a specific task. It also contains the
Hardware and the Software features of the app, which determines the compatibility
of an app on the Play Store. It also includes special activities like services, broadcast
receiver, content providers, package name, etc.

• Java Folder: The JAVA folder consists of the java files that are required to perform
the background task of the app. It consists of the functionality of the buttons,
calculation, storing, variables, toast(small popup message), programming function,
etc. The number of these files depends upon the type of activities created.
Android Fundamentals
• Resource Folder: The res or Resource folder consists of the various resources that are used in the app. This
consists of sub-folders like drawable, layout, mipmap, raw, and values. The drawable consists of the images. The
layout consists of the XML files that define the user interface layout. These are stored in res.layout and are accessed
as R.layout class. The raw consists of the Resources files like audio files or music files, etc. These are accessed
through R.raw.filename. values are used to store the hardcoded strings(considered safe to store string values)
values, integers, and colors. It consists of various other directories like:
• R.array :arrays.xml for resource arrays
• R.integer : integers.xml for resource integers
• R.bool : bools.xml for resource boolean
• R.color :colors.xml for color values
• R.string : strings.xml for string values
• R.dimen : dimens.xml for dimension values
• R.style : styles.xml for styles
Android Fundamentals
• Gradle Files: Gradle is an advanced toolkit, which is used to manage the build process, that allows defining the
flexible custom build configurations.

Each build configuration can define its own set of code and resources while reusing the parts common to all
versions of your app.
The Android plugin for Gradle works with the build toolkit to provide processes and configurable settings
that are specific to building and testing Android applications.
Gradle and the Android plugin run independently of Android Studio. This means that you can build your
Android apps from within Android Studio. The flexibility of the Android build system enables you to
perform custom build configurations without modifying your app’s core source files.
Android Fundamentals
Android Fundamentals
States of Android Lifecycle:

1. OnCreate: This is called when activity is first created.


2. OnStart: This is called when the activity becomes visible to the user.
3. OnResume: This is called when the activity starts to interact with the user.
4. OnPause: This is called when activity is not visible to the user.
5. OnStop: This is called when activity is no longer visible.
6. OnRestart: This is called when activity is stopped and restarted again.
7. OnDestroy: This is called when activity is to be closed or destroyed.
Android Fundamentals
Assignment
Write all the Android Versions with their respective names and year. Also mention the updates which are there
been done from previous OS’s.

You might also like