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

Mobile Application Development

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

Uploaded by

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

Mobile Application Development

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

Uploaded by

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

MOBILE APPLICATION

DEVELOPMENT
Presented By
S.Vijayalakshmi B.E,
Assistant Professor,
Department of Computer Science,
Sri Sarada Niketan College for Women, Karur.
ANDROID

 Android is a complete set of software for


mobile devices such as tablet computers,
notebooks, smart phones, electronic book
readers, set-top boxes etc.
 Android is a software package and linux

based operating system for mobile devices


such as tablet computers and smart phones.
 It is developed by Google and later the OHA

(Open Handset Alliance). Java language is


mainly used to write the android code even
though other languages can be used.
HOW IS THE ANDROID PLATFORM
ORGANIZED?
 The Android platform is organized into
the following sections:
Android applications: This is the
topmost layer in the Android platform
stack and is comprised of applications
that are built-in (developed by the
Android team) or any other third party
applications that have been installed
on the device.
WHAT IS THE ARCHITECTURE OF THE
ANDROID PLATFORM?
 This article presents an overview
of the architecture of the Android
Platform—a popular platform for
mobile devices the world over.
 The Android operating system

provides many services that


include support for security,
virtual memory, multitasking, and
threads—all features of modern
day operating systems.
WHAT IS ANDROID SDK PLATFORM-TOOLS?

 Android SDK Platform-Tools is a


component for the Android SDK.
 It includes tools that interface

with the Android platform,


primarily adb and fastboot .
 Although adb is required for

Android app development, app


developers will normally just use
the copy Studio installs.
ANDROID SDK
 The Android SDK is composed of multiple
packages that are required for app
development.
 You can install and update each package using

Android Studio's SDK Manager or the


sdkmanager command-line tool.
 All of the packages are downloaded into your

Android SDK directory, which you can locate as


follows:
 In Android Studio, click File > Project

Structure.
 Select SDK Location in the left pane. The path

is shown under Android SDK location.


SET ENVIRONMENT VARIABLES

 We recommend setting the environment


variable for ANDROID_HOME when using the
command line.
 Also, set your command search path to

include ANDROID_HOME/tools, ANDROID_HO


ME/tools/bin, and ANDROID_HOME/platform-
tools to find the most common tools.
 The steps vary depending on your OS, but

read How to set environment variables for


general guidance.
ANDROID SDK COMMAND-LINE
TOOLS
 Located in: android_sdk/cmdline-tools/version/bin/
 pkanalyzer Provides insight into the composition of

your APK after the build process completes.


 Avdmanager Lets you create and manage Android

Virtual Devices (AVDs) from the command line.


 Lint Scans code to help you identify and correct

problems with the structural quality of your code.


 Retrace For applications compiled by

R8, retrace decodes an obfuscated stack trace that


maps back to your original source code.
 Sdkmanager Lets you view, install, update, and

uninstall packages for the Android SDK


ANDROID SDK BUILD TOOLS
 Located in: android_sdk/build-tools/version/
 This package is required to build Android apps.

Most of the tools in this package are invoked by


the build tools and not intended for you. However,
the following command-line tools might be useful:
 AAPT2 Parses, indexes, and compiles Android

resources into a binary format that is optimized for


the Android platform and packages the compiled
resources into a single output.
 apksigner Signs APKs and checks whether APK

signatures will be verified successfully on all


platform versions that a given APK supports.
 zipalign Optimizes APK files by ensuring that all

uncompressed data starts with a particular


alignment relative to the start of the file.
ANDROID SDK PLATFORM TOOLS
 Located in: android_sdk/platform-tools/
 These tools are updated for every new version of
the Android platform to support new features and
fix or improve the tools, and each update is
backward compatible with earlier platform versions.
 Adb Android Debug Bridge (adb) is a versatile tool
that lets you manage the state of an emulator
instance or Android-powered device. You can also
use it to install an APK on a device.
 Etc1tool A command-line utility that lets you
encode PNG images to the ETC1 compression
standard and decode ETC1 compressed images
back to PNG. fastbootFlashes a device with
platform and other system images.
ANDROID EMULATOR
 Located in: android_sdk/emulator/
 This package is required to use the Android

Emulator. It includes the following:


 Emulator A QEMU-based device-emulation

tool that you can use to debug and test your


applications in an actual Android run-time
environment.
 Mksdcard Helps you create a disk image that

you can use with the emulator to simulate


the presence of an external storage card,
such as an SD card.
JETIFIER

 Jetifier reads a library that uses Support


Library classes and outputs an equivalent
library that uses the newer AndroidX classes.
 The jetifier is a handy tool that automatically

migrates your dependencies to AndroidX at


build time.
 Without it, you'd need every dependency you

use to have an AndroidX version before you


can migrate, and that probably won't happen
for some time.
HOW TO INSTALL ECLIPSE IN WINDOWS 11

 InstallingEclipse on Windows
11 involves downloading the
Eclipse installer, running it, and
setting up the IDE to your
preference.
 Follow these steps to get

Eclipse up and running


smoothly on your Windows 11
machine.
ECLIPSE INSTALLATION

 Step 1: Download the Eclipse Installer


 Visit the official Eclipse website and download the
Eclipse installer for Windows.
 Go to the Eclipse Downloads page and click on the
download link for the "Eclipse Installer." Make sure
to choose the right version for your Windows 11
system, typically the 64-bit version.

 Step 2: Run the Eclipse Installer


 Once the installer is downloaded, locate the file in
your downloads folder and run it.
 Double-click the Eclipse installer file. If a security
prompt appears, click "Run" to proceed. You’ll see
the Eclipse Installer window pop up.
STEP 3: CHOOSE THE ECLIPSE IDE PACKAGE
 Inthe Eclipse Installer window, choose
the Eclipse IDE package that suits your
needs and click "Install."
 For most users, "Eclipse IDE for Java

Developers" is a good choice.


 However, if you need other

functionalities, explore the available


packages and select the one that fits
your requirements.
STEP 4: SELECT THE INSTALLATION
FOLDER

 Select the directory where you


want Eclipse to be installed, then
click "Install."
 You can either go with the default

directory or choose a different


location on your computer.
 Make sure you have enough

space in the chosen directory for


the installation.
STEP 5: ACCEPT THE LICENSE AGREEMENT

 Read through the license


agreement and click "Accept" to
proceed with the installation.
 It’s important to understand the

terms, though it’s mostly


standard stuff.
 Once accepted, the installation

will begin, which might take a few


minutes.
STEP 6: LAUNCH ECLIPSE

 After the installation completes, click


"Launch" to open Eclipse.
 The first time you launch Eclipse, you’ll

be asked to select a workspace.


 This is the directory where your

projects will be stored. Choose a


directory and click "Launch."
 Once you’ve completed these steps,

Eclipse will open, and you’ll be ready to


start developing your projects.
INSTALL ANDROID
 Android supports java, c++, c# etc. language
to develop android applications.
 Java is the officially supported language for

android.
 All the android examples of this site is

developed using Java language and Eclipse


IDE.
 Here, we are going to tell you, the required

softwares to develop android applications


using Eclipse IDE.
 There are two ways to install android.
 By ADT Bundle
 By Setup Eclipse Manually
1) BY ANDROID STUDIO
 It is the simplest technique to install required
software for android application. It includes:
Eclipse IDE
Android SDK
Eclipse Plugin

2) By set up eclipse manually


o Visit the next page to learn about setting
up android in eclipse manually.
MY FIRST APP: HOW TO CREATE YOUR
FIRST ANDROID APP STEP BY STEP
 To create a native Android app, one that can
directly use all the features and functionality
available on an Android phone or tablet, you need
to use the Android platform's Java API framework.
 This is the API that allows you to perform common

tasks such as drawing text, shapes, and colors on


the screen, playing sounds or videos, and
interacting with a device's hardware sensors.
 Over the years, the Android API framework has

evolved to become more stable, intuitive, and


concise. As a result, being an Android developer
today is easier than ever—even more so if you use
Android Studio, the official tool for working with
the framework.
1. CREATE A NEW PROJECT

 You'll need an Android Studio project to


design, develop, and build your app.
 So launch Android Studio and click on

the Start a new Android Studio


project button.
 On the next screen, choose Add No

Activity because we don't want to use any


of the templates offered by Android Studio.
Then press Next to proceed.
 You'll now see a form where you can enter
important details about your app, such as its
name and package name. The name is, of
course, the name your users will see on their
phones when they install your app.
 The package name, on the other hand, is a

unique identifier for your app on Google Play.


You must follow the Java package naming
conventions while specifying it. For example,
if your app's name is MyFirstApp and you
work for an organization whose website
address is example.com, the package name
would ideally be "com.example.myfirstapp".
 Next, you must decide the programming

language you want to use while coding the


app. For now, select Java and press Finish.
2. CREATE AN ACTIVITY
 An activity is one of the most important components of an
Android app. It is what allows you to create and display a
user interface to your users. An app can have one or more
activities, each allowing the user to perform an action. For
example, an email client app can have three activities:
one for the user to sign up, one to sign in, and one to
compose an email.
 To keep this tutorial simple, we'll be creating an app with
just one activity. To create the activity, in
the Project panel of Android Studio, right-click
on app and select New > Activity > Empty Activity.
 In the dialog that pops up, type in MainActivity as the
name of the activity, check the Launcher
Activity option, and press Finish.
 Checking the Launcher Activity option is important
because it is what allows your users to open the activity
using an Android launcher. As such, a launcher activity
serves as an entry point to your app.
3. CREATE A LAYOUT
 Each activity usually has at least one layout
associated with it. When you created your activity in
the previous step, you also generated an empty
layout for it. To take a look at it, open
the activity_main.xml file.
 An activity's layout primarily consists of views and
view groups. A view, sometimes referred to as a
widget, is an individual component of your user
interface. Buttons, text fields, labels, and progress
bars are common examples of views. A view group is
a component that can serve as a container for views.
Usually, view groups also help you position and set
the dimensions of your views.
 ConstraintLayout is one of the most powerful and
flexible view groups available today. By default, it is
the root node of your activity's layout XML file. It
looks like this:
4. IMPLEMENT EVENT HANDLERS

 When you generated event handlers for


the two buttons, Android Studio added
two methods to your activity's Java
file, MainActivity.java.
 If you open it, you should find the

following code in it:


 public void onClickGermany(View view) {

}
public void onClickIndia(View view) { }
THE ANATOMY OF AN ANDROID APPLICATION

 The two different components that can be used to


create an application and the mechanisms that
work together to create a unified application.
1. Activities in Android
 Those who know Object-oriented languages can

understand the concept of encapsulating the


elements of application functionalities and then
used as objects to creating and manipulating the
application. Since Android applications developed in
Java and Kotlin. So Android architecture also has the
concept of reusable components to the higher level.
 Android application is developed by one or more

components that work together, these components


are activities. Activity is a single and independent
1. ACTIVITIES IN ANDROID
 For example, a Job finder application has an activity that will
display the list of available jobs for the current day. The
application might have another activity that will take professional
details of candidates.
 An Activity is a completely reusable and interchangeable
component of an application that can be intended from other
applications. Rather than making a new Activity for sending the
email in the new application, a developer can call or intend the
email activity of an existing application like Gmail, outlook, or
yahoo.
 Each time activity that is display will be created as a subclass of
the Activity class which comes from Android. So Each activity is
called independently, activity didn’t depend on a specific type of
application flow it is completely independent and can be intended
directly.
 The Activity cannot be using its instance and one activity can’t
call directly any method or use instance data of other activity. So
Instead of this, you should use Intent and Content Providers.
 Activity can’t give the results to another activity from which it
intended or invoked. If you want to get results from the invoked
activity, so you must invoke it as a sub-activity of originating
2. FRAGMENT IN ANDROID
 As I describe above activity is a single user interface with
a layout design file and a java class for dynamic
functionalities.
 One way to make Android apps by using the activities as
required screens. But it is good to make a different
section in the activity layout.
 So that it is easy to categorize user interface and it
reduces the coupling and increases the separation of the
concern in the app coding.
 The fragment represents a separate part of a user
interface or activity layout or any other layout. So we can
use fragments as a separate section in an activity layout.
 An activity can become just a container of the different
fragments with different layouts. It is preferable to create
a single activity that switches between different
fragments as a different screen in the app.
3. INTENT IN ANDROID
 The intent is a built-in class from android SDK
which is used to launch another activity from
one activity and using intent we can
implement a flow of activities that can make
a complete application.
 Intent can contain the data about the

operation to be performed and data which is


passing from one activity to another activity.
 There are two types of intent.

1.Explicit Intent
2.Implicit Intent
1. Explicit Intent
 It will specify which application or package

name fully satisfies the intent.


 For example, if you want to open a specific

application or you want to open another


application.
2.Implicit Intent
 It will not specify the name of any component

but instead of it, it will use general action to


perform.
 For example, you want to show the specific

location on the map so you can use implicit


intent with a specific action, and which app
qualifies for it will be selected.
ANDROID MANIFEST FILE
 Every project in Android includes
a Manifest XML file, which
is AndroidManifest.xml, located in the root
directory of its project hierarchy.
 The manifest file is an important part of our

app because it defines the structure and


metadata of our application, its components,
and its requirements.
 This file includes nodes for each of

the Activities, Services, Content Providers,


and Broadcast Receivers that make the
application, and using Intent Filters and
Permissions determines how they coordinate
with each other and other applications.
 The manifest file also specifies the application
metadata, which includes its icon, version number,
themes, etc., and additional top-level nodes can specify
any required permissions, and unit tests, and define
hardware, screen, or platform requirements.
 The manifest comprises a root manifest tag with a
package attribute set to the project’s package. It
should also include an xmls:android attribute that will
supply several system attributes used within the file.
 We use the versionCode attribute is used to define the
current application version in the form of an integer
that increments itself with the iteration of the version
due to update. Also, the versionName attribute is used
to specify a public version that will be displayed to the
users.
 We can also specify whether our app should install on
an SD card of the internal memory using the
installLocation attribute. A typical manifest file looks as:
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 package="com.example.geeksforgeeks"
 android:versionCode="1"
 android:versionName="1.0"
 android:installLocation="preferExternal">

 <uses-sdk
 android:minSdkVersion="18"
 android:targetSdkVersion="27" />

 <application
 android:allowBackup="true"
 android:dataExtractionRules="@xml/data_extraction_rules"
 android:fullBackupContent="@xml/backup_rules"
 android:icon="@mipmap/ic_launcher"
 android:label="@string/app_name"
 android:roundIcon="@mipmap/ic_launcher_round"
 android:supportsRtl="true"
 android:theme="@style/Theme.MyApplication"
 tools:targetApi="31">
 <activity
 android:name=".MainActivity"
 android:exported="true">
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />

 <category android:name="android.intent.category.LAUNCHER" />


 </intent-filter>
 </activity>
 </application>

 A manifest file includes the nodes that define
the application components, security
settings, test classes, and requirements that
make up the application. Some of the
manifest sub-node tags that are mainly used
are:
1. manifest
 The main component of the

AndroidManifest.xml file is known as


manifest. Additionally, the packaging field
describes the activity class’s package name.
 It must contain an <application> element

with the xmlns:android and package attribute


specified.
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="
http://schemas.android.com/apk/res/android"
 xmlns:tools="
http://schemas.android.com/tools"
 package="com.example.geeksforgeeks">

 <!-- manifest nodes -->


 <application>

 </application>

 </manifest>
2. USES-SDK
 It is used to define a minimum and maximum
SDK version by means of an API Level integer
that must be available on a device so that
our application functions properly, and the
target SDK for which it has been designed
using a combination of minSdkVersion,
maxSdkVersion, and targetSdkVersion
attributes, respectively.
 It is contained within the <manifest>

element.
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="27" />
3. USES-PERMISSION

 It outlines a system permission that must be


granted by the user for the app to function
properly and is contained within the
<manifest> element.
 When an application is installed (on Android

5.1 and lower devices or Android 6.0 and


higher), the user must grant the application
permissions.
 <uses-permission

android:name="android.permission.CAMERA
"
android:maxSdkVersion="18" />
4. APPLICATION

 A manifest can contain only one application


node. It uses attributes to specify the
metadata for your application (including its
title, icon, and theme). During development,
we should include a debuggable attribute set
to true to enable debugging, then be sure to
disable it for your release builds.
 The application node also acts as a container

for the Activity, Service, Content Provider,


and Broadcast Receiver nodes that specify
the application components. The name of our
custom application class can be specified
using the android:name attribute.
5. USES-LIBRARY

 It defines a shared library against which


the application must be linked.
 This element instructs the system to add

the library’s code to the package’s class


loader.
 It is contained within the <application>

element.
6. ACTIVITY
 The Activity sub-element of an application
refers to an activity that needs to be
specified in the AndroidManifest.xml file. It
has various characteristics, like label, name,
theme, launchMode, and others.
 In the manifest file, all elements must be

represented by <activity>. Any activity that


is not declared there won’t run and won’t be
visible to the system. It is contained within
the <application> element.
8. ACTION
 It adds an action for the intent-filter. It is
contained within the <intent-filter> element.

9. category

 It adds a category name to an intent-filter. It


is contained within the <intent-filter>
element.
10. USES-CONFIGURATION

 The uses-configuration components are


used to specify the combination of
input mechanisms that are supported
by our application.
 It is useful for games that require

particular input controls.


THANK YOU

You might also like