Professional Documents
Culture Documents
M1 ABCDE-Android Introduction
M1 ABCDE-Android Introduction
M1 ABCDE-Android Introduction
Introduction to Mobile
Apps and Android
Need for Mobile Apps
Mobile Apps Offer Better Personalization
Personalization is about offering tailored communication to users
based on their interests, location, usage behaviour, and more.
The javac tool compiles the java source file into the class file.
The dx tool takes all the class files of your application and generates a single
.dex file. It is a platform-specific tool.
The Android Assets Packaging Tool (aapt) handles the packaging process.
Android Emulator
• Simulates Android devices on your computer so that you can test
your application on a variety of devices and Android API levels
without needing to have each physical device.
• When you launch the emulator, it loads the user data and SD
card data from the AVD directory.
Android Components
• Piece of code that has a well defined life cycle
• The core building blocks or fundamental components of
Android are Activities, Services, Content Providers and
Broadcast Receivers.
• These components are loosely coupled by the
application manifest file AndroidManifest.xml that
describes each component of the application and how
they interact.
Ø Activities dictate the UI and handle the user
interaction to the smart phone screen.
Ø Services handle background processing associated
with an application.
Ø Broadcast Receivers handle communication
between Android OS and applications.
Ø Content Providers handle data and database
Android Components
• Besides the fundamental components there are
additional components:
Ø Fragments - represent a portion of user interface in
an Activity.
Ø Views - UI elements that are drawn on-screen
including buttons, lists forms etc.
Ø Layouts - View hierarchies that control screen
format and appearance of the view.
Ø Intents - Messages wiring components together.
Ø Resources - External elements, such as strings,
constants and drawable pictures.
Ø Manifest - Configuration file for the application.
Android Components
View
• Views are user interface (UI) elements that form
the basic building blocks of a user interface.
• Can be a button, a label, a text field, or many
other UI elements.
• Also used as containers for views, which means
there’s usually a hierarchy of views in the UI.
Android Components
Activity
• An activity is a UI concept that usually represents a single
screen in your application.
• It generally contains one or more views, but it doesn’t have to.
• Helps the user do one thing, which could be viewing data,
creating data, or editing data.
• Most Android applications have several activities within them.
Fragment
• When a screen is large, it becomes difficult to manage all of its
functionality in a single activity. Fragments are like sub-
activities, and an activity can display one or more fragments on
the screen at the same time. When a screen is small, an
activity is more likely to contain just one fragment, and that
fragment can be the same one used within larger screens.
Android Components
Services
• Services in Android resemble services in Windows or other
platforms.
• A service is a component that runs in the background to
perform long-running operations.
• Android defines two types of services: local services and
remote services.
• Local services are components that are only accessible by
the application that is hosting the service.
• Conversely, remote services are services that are meant to be
accessed remotely by other applications running on the
device.
• An example of a service is a component that is used by an e-
mail application to poll for new messages. This kind of service
may be a local service if the service is not used by other
applications running on the device. If several applications use
Android Components
Content Provider
• A standard mechanism for applications to share data
(such as a list of contacts) without exposing the
underlying storage, structure, and implementation.
• Through content providers, you can expose your data
and have your applications use data from other
applications.
Android Components
Broadcast Receivers
• Simply respond to broadcast messages from other
applications or from the system itself. These messages
are sometime called events or intents.
• 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.
• There are following two important steps to make
Broadcast Receiver work for the system broadcasted
intents −
– Creating the Broadcast Receiver
– Registering Broadcast Receiver
Android Components
Intent
• An intent generically defines an “intention” to do some work.
• Hamburger Menu
– Hamburger menu (or
side drawer) is one of
the most popular
mobile navigation
patterns.
– The drawer panel
allows you to hide the
navigation beyond
the left edge of the
screen and reveal it
only upon a user’s
action.
Basic Navigation Patterns
Hamburger Menu
• Advantages
– Large number of navigation options it can
accommodate a large number of navigation options in a
tiny space.
– Clean design allows the designer to free up screen by
shifting options off screen into a side menu.
• Disadvantages
– Less discoverable When navigation is hidden, users
are less likely to use it.
– Clashes with platform navigation rules almost a
standard on Android, but in iOS it simply cannot be
implemented without clashing with basic navigation
elements.
– The hamburger icon hides context it doesn’t
communicate the current location at a glance:
– Extra action is required to move to the target
destination reaching a particular page usually takes at
least two taps (one tap on the menu icon and another on
Basic Navigation Patterns
• Tab Bar
– Inherited from
desktop design.
– Usually contains
relatively few
destinations, and
those destinations
are of similar
importance and
require direct access
from anywhere in the
app.
Basic Navigation Patterns
Tab Bar
• Advantages
– The tab bar fairly easily communicates the current
location. Properly used visual cues (icons, labels and
colors) enable the user to understand their current
location at a glance.
– Tab bars are persistent. The navigation remains in
sight no matter what page the user is viewing.
• Disadvantages
– The navigation options are limited. If your app has
more than five options, then fitting them in a tab or
navigation bar and still keeping an optimum touch-
target size would be hard.
– The location and logic of the tab bar options on
iOS and Android are different has to be taken into
consideration when designing a tab bar for a
particular platform.
Basic Navigation Patterns
• Priority +
– navigation that exposes the most important
navigation elements and hides away less
important items behind a “more”/+ button.
Basic Navigation Patterns
Priority +
• Advantages
– Prioritizes navigation options surfaces the
most frequently accessed navigation options.
– Makes use of available screen space As
space increases, the number of exposed
navigation options increases.
– This menu is very adaptive can be scaled
across screen sizes without having to transform
the pattern.
• Disadvantages
– Might hide some important navigation options
requires designers to assume the relative
importance of navigation items may not be the
Basic Navigation Patterns
• Floating Action
Button
– Shaped like a circled
icon floating above
the UI, the floating
action button
changes color upon
focus and lifts upon
selection.
– Floating above the
interface of an app,
it promotes user
action
Basic Navigation Patterns
Floating Action Button
• Advantages
– Good way to prioritize the most important
action you want users to take.
– It takes up little screen space.
– It also improves effectiveness a floating
action button slightly impairs usability when
users first interact with the button. However,
once users have successfully completed a task
using the element, they are able to use it more
efficiently than a traditional action button.
Basic Navigation Patterns
Floating Action Button
• Disadvantages
– Can distract users
from content.
– Can block content.
Additional scrolling is
needed whenever the
user wants to see this
information.
– It is an icon-only
navigation icon-
only button, with no
room for text labels
hard to understand
Basic Navigation Patterns
• Full-Screen Navigation
– This navigation approach
usually devotes the home page
exclusively to navigation.
– Users incrementally tap or
swipe to reveal additional
menu options as they scroll up
and down.
Basic Navigation Patterns
Full-Screen Navigation
• Advantages
– The full-screen navigation pattern is best for
achieving simplicity and coherence.
• Disadvantages
– You won’t be able to display any content
except the navigation options.
Basic Navigation Patterns
• Gesture-Based Navigation
– uses swipes and other actions to control the
phone, rather than tapping on buttons
– has become a universal mode of navigation on
modern phones.
– Gestures swipe, flick, pinch, spread, rotate,
tap, double tap, long press.
Basic Navigation Patterns
Gesture-Based Navigation
• Advantages
– It removes UI clutter allows you to make your
interfaces more minimal and to save screen
space for valuable content.
– The UI is more natural gestures tend to be
similar across culture and experience
• Disadvantages
– The navigation is invisible not easily
discoverable can give rise to usability issues.
– User effort increases. Most gestures are neither
natural nor easy to learn or remember. without
proper visual hints and cues users could get
confused about how to interact with the app.
Screen Independent Design
Screen Resolution
• Resolution is always referred in x*y form, which
means x is the number of pixels in horizontal
direction and y is the number of pixels in the
vertical direction.
• Example : HD display 1920*1080 = 2,073,600 is
the total pixels on screen
Pixel density
• The number of pixels that fit into an inch is
referred to as pixel density (resolution)
• Screen pixel density and resolution vary
depending on the platform.
Screen Independent Design
Density independence
• refers to the uniform display of UI elements on screens
with different densities.
Density-independent pixels
• Written as dp (pronounced “dips”), are flexible units
that scale to have uniform dimensions on any screen.
• They provide a flexible way to accommodate a design
across platforms.
• Material UIs use density-independent pixels to display
elements consistently on screens with different
densities.
• When developing an Android app, use dp to display
elements uniformly on screens with different densities.
Pixel density on Android
Dp and screen density
• A dp is equal to one physical pixel on a screen with a
density of 160.
To calculate dp:
• dp = (width in pixels * 160) / screen density