Mobile Application Development
School of Computer Science and Engineering
Ms. Soujanya B K
[Link]@[Link]
AY: 2023-2024
Contents
• Introduction to Android
• The Android Platform
• Android SDK
• Eclipse Installation
• Android Installation,
• Building you First Android application
• Understanding Anatomy of Android Application,
• Android Manifest file.
History to Android
Andy Rubin
Chris white
Rich miner
Nick sears
Introduction to Android
Introduction to Android Development
Android is one of the most popular operating systems with
over 90% of phones running android
This consists of two main files
XML
JAVA
An XML file is used to build layouts in Android.
Layouts are static pages(screens) that can be manipulated using java
code (programmatically)
Declaring UI’s in XML enables us to better separate the presentation
of our application from the code that controls its behavior.
What is an Android platform?
Android OS is a Linux-based mobile operating system that
primarily runs on smartphones and tablets.
The Android platform includes an operating system based on the
Linux kernel, a GUI, a web browser, and end-user applications
that can be downloaded.
Android SDK
The Android SDK (software development kit) is a set of
development tools used to develop applications for the
Android platform that has become Apple's biggest rival in the
smartphone space
Difference between Android Studio and
Android SDK?
Android SDK belongs to the "Frameworks (Full Stack)" category of the
tech stack, while Android Studio can be primarily classified under
"Integrated Development Environment".
Installing Android Studio
Android Studio is an IDE that makes it easy for us to write and build
android applications very conveniently
we can create emulators (virtual android phones), see previews, and
build UI layouts using drop features
You can go to [Link] [Link]/studio to download
android studio.
Click on the “I have read and agree with the above terms and conditions”
checkbox followed by the download button.
Click on the agree and download button in the appeared prompt box and the file will start
downloading.
After the downloading has finished, open the file from downloads and run it. It will
prompt the following dialog box.
Click on next. In the next prompt, it’ll ask for a path for installation. Choose a
path and hit next.
It will start the installation, and once it is completed, it will be like the image shown below.
Click on next.
Once “Finish” is clicked, it will ask whether the previous settings need to be
imported [if the android studio had been installed earlier], or not. It is better
to choose the ‘Don’t import Settings’ option’.
Click the OK button.
This will start the Android Studio.
Meanwhile, it will be finding the available SDK components.
After it has found the SDK components, it will redirect to the Welcome dialog box.
Click on Next.
Choose Standard and click on Next. Now choose the theme, whether the Light theme or
the Dark one. The light one is called the IntelliJ theme whereas the dark theme is
called Dracula. Choose as required.
Click on the Next button.
Now it is time to download the SDK components
Click on Finish. Components begin to download let it complete.
The Android Studio has been successfully configured. Now it’s time to launch and build apps. Click
on the Finish button to launch it.
Click on Start a new Android Studio project to build a new app.
The Layout Editor
The layouts editor is used to
quickly build layouts by
dragging UI elements which is
easier to write XML by hand.
We can easily set up different
attributes using the layout
editor's design mode.
Creating our first APP
we will create our first android app.
• What is an APK?
An APK is a collection of different files (like code, audio, video, etc.)
compiles and bundled into a single file.
• What is an AVD?
AVD stands for Android virtual device AVC is an emulator
configuration that simulates a physical Android device.
Android UI layouts
• View is the base class for widgets (like buttons, text fields etc.)
• View = Basic building blocks
• View group(for eg. Container) holds view and view group. (just like a
box can hold objects and more boxes)
XML vs Java in Android
XML is the skeleton code that describes the UI layout java drives this
XML
Creating our app
• We will now create our application using the Android Studio
Step 1:
click on create a new
project
Step 2:
select an empty
activity and click
on next
Step 3:
Type the name of the
application and click
finish
Wait for Gradle build to finish
Creating our app
We will now create our application using the Android Studio
The R. java file
Android [Link] file contains resource IDs for all the resources we can
use to access views from our java file.
button in xml has an id of
Function to get the
“mybutton”
views
Adding Event listeners
We can add click listeners by using set on click listener method as follows:
Android onclick attribute
The onclick attribute can be set for the button in xml layout
android: onclick=“calculate”-------------> in XML file
Public void calculate(view view){
//logic here
}--------------> in java file
Android manifest file
What is an Android manifest file?
The manifest file describes essential information about your
app to the Android build tools, the Android operating
system, and Google Play.
Among many other things, the manifest file is
required to declare the following:
• The components of the app, which include all activities,
services, broadcast receivers, and content providers
• The permissions that the app needs in order to access
protected parts of the system or other apps
• It also declares any permissions that other apps must have if
they want to access content from this app
• The hardware and software features the app requires, which
affects which devices can install the app from Google Play
App components
For each app component that you create in your app, you must declare a
corresponding XML element in the manifest file:
•<activity> for each subclass of Activity.
•<service> for each subclass of Service.
•<receiver> for each subclass of BroadcastReceiver.
•<provider> for each subclass of ContentProvider.