Unit 1 Mobile Application Development
Unit 1 Mobile Application Development
UNIT : 1
Prepared by
Senthil Kumar S
Assistant Professor,
Department of Information Technology,
Sri Ramakrishna Mission Vidyalaya
College of Arts and Science
(Autonomous), Coimbatore
MOBILE APPLICATION DEVELOPMENT
Unit – I
Introducing Android: Before we get started – Advantages of android – Preparing SDK
tools to download – Android development IDE – Java, XML and how android works –
Android application framework – Screen layout design – User Interface Design – Graphics
and animation Design – Interactivity – Content providers – Intent and intent filters. (Pg
No: 1-19). Introducing the basics in android application techniques.*
Unit – II
Setting up your android development environment – Installing Java, Eclipse and Android –
Setting up AVDs and Smart Phone – Understanding Java SE and the Dalvik Virtual
Machine– The directory structure of an android project – Leveraging android XML – Using
your android application resources – The AndroidManifest.xml file – Creating your first
android application.(PgNo:21-85).
Launching the android development environment.*
Unit – III
Android application components – Android Intent Objects: Messaging for Components
– Android Manifest XML: Declaring Your Components – Android View Hierarchies –
Defining Screen Layouts: Using XML. (Pg No: 115-160)
The various components used in android intent objects.*
Unit – IV
UI Design: Buttons, Menus and Dialogs – Using Android UI Elements (Widgets) –
Adding an Image Button to Your Layout – Adding a Text View Widget to Your Layout –
Adding an Image – Using Menus in Android – Creating the Menu Structure with XML –
Defining Menu Item Strings – Inflating the Menu Structure via Java – Running the
Application in the Android Emulator – Making the Menu Work – Adding Dialogs –
Using Custom Dialog Subclasses – Displaying an Alert Dialog. (Pg No: 163-207)
Using Android UI elements.*
Unit - V
Adding Interactivity: Handling UI Events – An Overview of UI Events in Android
– HandlineonClick Events – Android Touchscreen Events: onTouch – Android Right-
click Equivalent: onLongClick – Key Event Listeners: onKeyUp and onKeyDown –
Context Menus in Android: onCreateContextMenu. (Pg No: 235-266)
Unit – I
Introducing Android: Before we get started – Advantages of android – Preparing SDK
tools to download – Android development IDE – Java, XML and how android works –
Android application framework – Screen layout design – User Interface Design – Graphics
and animation Design – Interactivity – Content providers – Intent and intent filters. (Pg
No: 1-19). Introducing the basics in android application techniques.*
INTRODUCTION TO ANDROID:
Andy Rubin’s creation called Android was purchased by Google in 2005
and made freely available to developers to create mobile device
applications using Java and XML.
Android was originally created by Andy Rubin as an operating system for
mobile phones.
In 2005, Google acquired Android Inc., and made Andy Rubin the
Director of Mobile Platforms for Google.
Android has the power of a full-blown computer operating system. It is
based on the Linux open source platform and Oracle’s (formerly Sun
Microsystems’s) Java, one of the world’s most popular programming
languages.
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.
The goal of android project is to create a successful real-world product
that improves the mobile experience for end users.
Android has expanded beyond a pure mobile phone platform to provide a
development platform for an increasingly wide range of hardware,
including tablets and televisions.
Android is an ecosystem made up of a combination of three components:
A free, open-source operating system for embedded devices
An open-source development platform for creating applications
Devices, particularly mobile phones, that run the Android operating
system and the applications created for it
Android is made up of several necessary and dependent parts, including
the following:
A Compatibility Definition Document (CDD) and Compatibility Test
Suite (CTS) that describe the capabilities required for a device to support
the software stack.
A Linux operating system kernel that provides a low-level interface with
the hardware, memory management, and process control, all optimized
for mobile and embedded devices.
Open-source libraries for application development, including SQLite,
WebKit, OpenGL, and a media manager.
A run time used to execute and host Android applications, including the
Dalvik Virtual Machine (VM) and the core libraries that provide
Android-specific functionality. The run time is designed to be small and
efficient for use on mobile devices.
An application framework that agnostically exposes system services to
the application layer, including the window manager and location
manager, databases, telephony, and sensors.
A user interface framework used to host and launch applications.
A set of core pre-installed applications.
A software development kit (SDK) used to create applications, including
the related tools, plug-ins, and documentation.
ADVANTAGES OF ANDROID:
ECLIPSE
Eclipse is an integrated development environment (IDE), which is a
piece of software dedicated to allowing you to more easily write
programming code, and run and test that code in an integrated
environment. In other words, you write all your code into its text editor,
before running and testing that code using commands in Eclipse, without
ever needing to switch to another program.
Android SDK
The Android Software Development Kit (SDK) is a collection of files and
utilities that work hand in hand with the Eclipse IDE to create an
Android-specific development tool.
To dowload the Android SDK, go to the Android Developers web site,
located at this URL:
http://developer.android.com/sdk/index.html
Now an android project have been created. You can explore the android project
and see the simple program, it looks like this:
For writing the message we are using the TextView class. Change the onCreate
method as:
TextView textview=new TextView(this);
textview.setText("Hello android! How r u");
setContentView(textview);
package com.example.helloandroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview=new TextView(this);
textview.setText("Hello Android!");
setContentView(textview);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Click the button1.xml tab at the top of your screen, and then type in the
XML code that defines the selector and item tags for setting the three
different image button states:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/button1_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/button1_focused" />
<item android:drawable="@drawable/button1_normal" />
</selector>
After you’ve entered the XML, you’ll notice that Eclipse shows that there
are three errors in the markup relating to missing file assets. Place your
mouse over the red X on the left margin by the markup code. This pops up a
diagnostic message regarding why Eclipse thinks this code needs your
attention, as shown in Figure
GRAPHICS AND ANIMATION DESIGN:
We’ll start adding application media elements through images, video, and
animation. These elements are key to making your application look great
across all Android phones.
The central set of classes used to control the graphics-related content
within your Android application is called the drawable package. This
package handles classes and methods related to drawing the following
onto the Android display screen:
Bitmaps: In a bitmap, a collection of pixels make up an image—it’s a
map of image bits.
Shapes: Shapes are line drawings. They also known as vectors, like
the lines architects use in CAD drawings
Gradients: Gradients are smooth transitions from one color to another
color. They can be shaped in a straight line or circular.
Transitions: Shape transitions are smooth vector changes between
one shape to another shape. This process is sometimes referred to as
morphing.
Animation: Animation is an image that moves in some way.
Image transitions: These are smooth fades between one image to
another image. They are usually used to transition from one image to
another image.
In Android development, graphics-related items like gradients, image
transitions, animated transformations, and frame-based animation can all be
termed drawables.
INTERACTIVITY:
Adding interactivity to applications, so that they respond to user input and
actually does something. You do this by handling UI events.
Android has provided a way to facilitate event handling.
The most efficient way of handing events that are triggered by your users
using the UI elements that are attached to the views and layouts defined in
your XML files.
Event listeners, which execute the proper code in response to an event that is
triggered when a UI element is used by the user (for instance, you can run
some code when a user touches a UI element or presses a key on the
keyboard)
Default event handlers that allow you to build event handling right into your
UI elements
Example: For instance, if a Button is touched, an onTouchEvent() method is
called on that object, because Android knows to call a method of that name
when that event occurs.
CONTENT PROVIDERS:
Content providers in Android provide a way to make data available to your
application and to other applications
Content providers handle data and database management issues.
These content providers allow you to access databases of system information
that are available through the Android operating system, as well as your own
databases of information.
Content providers, which are often databases filled with information, such as
a contact list, that applications may want to access to provide functionality of
their own.
Content providers are the only method Android provides for sharing data
across applications
Content providers expose their data via data models similar to databases, and
how to use cursors to traverse the database in various ways.
We’ll investigate URI objects and how to use them to identify and access
data sets. Each set of data in the database will have its own Uniform
Resource Identifier (URI), which is similar to an HTTP URL.
An Android content provider provides you with access to sharable data
structures commonly called databases.
The basic procedure is as follows:
1. Get permission to open the database.
2. Query the data.
3. Access the data.