Sie sind auf Seite 1von 52

ANDROID

MOBILE
APPLICATION
DEVELOPMEN
T

What is Android?
A software bunch comprising
not only operating system
but also middleware and key
applications.
Based on Linux with a Java
programming interface.
apk files are distributed and
installed on Android powered
devices.

Went open source in late 2008.


Released under the Apache v2 license.

Android Core Application

Features

Services
Background functionalities
Run in the applications' thread

using TOAST

using
NOTIFICATION

Android: Content Provider

Provides applications with required


application's data
Applications "talk" to content provider
through a content resolver.

Widgets and Views


Android provides several built-in views:
LinearLayout
TextView
RelativeLayo
Button
ut
EditText
TableLayout
ImageView
TableRow
ImageButton
ListView
CheckBox
GridView
RadioButton ScrollView
etc
etc

System Requirements
Before beginning Android
development, please make sure you
have the following installed:
1. Java Development Kit (JDK)
http://www.oracle.com/technetwork/java/
javase/downloads/index-jsp-138363.html

2. Eclipse-Android SDK
http://developer.android.com
(ADT bundle fo 32 and 64-bit)

ECLIPSE Integrated Development Tools

ECLIPSE Integrated Development Tools

ECLIPSE Integrated Development Tools

Creating a New Project

ECLIPSE Integrated Development Tools

ECLIPSE Integrated Development Tools

Switch here between


Graphical and XML code
view

ECLIPSE Integrated Development Tools

Switch here between Graphical and XML


code view

ECLIPSE Integrated Development Tools

Contains all graphical object for


the construction of the userinterface.

ECLIPSE Integrated Development Tools

src - contains all the


activity (Java classes)
specified by the user,
including the default
activity class.

First Android Project

The MainActivity.java is the activity created previously


when we create the project.
The code is auto-generated with the package which the
package name created previously when we create the
project.

onCreate(Bundle)
called when the activity
first starts up.

use to perform one-time


initialization such as
creating the user
interface.
takes one parameter that
is either null or some
state information
previously saved by the
onSaveInstanceState()
Android calls the onCreate( ) method of your activity to initialize it.
method.
The call to setContentView( ) fills in the contents of the activitys
screen with an Android view widget.

ECLIPSE Integrated Development Tools

The user-interface in the


Android mobile phone

ECLIPSE Integrated Development Tools


drawable folder(s)
contains all
image files.
layout folder
XML file with layout
description files
used to define the
user interface for
activities
and Fragments.
values folder used to define strings,
colors, dimensions, styles and static
arrays of strings or
integers.
menu folder Define the properties of
entries for a menu

ECLIPSE Integrated Development Tools

Important: All activities (program file) and


permission must be declare in the
projects AndroidManifest.xml

Create an Android Virtual Device

Option
No.2

Option
No.1

Option No.1 : Select Window -> Android Virtual Device


Manager from the menu.
Option No.2: Click the
icon for Android Virtual Device
Manager.

Define the name of the AVD. There


can be more than one AVD name
depending on the number of target
machine.
Define the target machine screen
size.
Define the Android version API level.
Automatically filled-up based on the
API Level.
Define the memory size that will be
consume by the AVD.

Define the minimum SD card that


machine could use.
Snapshot option the AVD stores its
state when it is closed, the second
time the AVD started, it will started
very fast.
Use Host GPU the AVD uses the
graphics card of the host computer
directly which makes the rendering
on the emulated device much faster.

An easy to way to
work with the
main.xml file is
through the properties
view
Window
> Show View
> Other
> General
>
Properties

Running the application on the emulator

For deploying and


running the app, you
need to define a run
configuration. Select
Open > Run > Dialog
or shortcut on the
toolbar within Eclipse or
press
CTRL + F11, and select
Android application.

The Emulator

Dealing with the string

REMINDER:
Always save your project
every time you create a
new object or edit an
object or file so that the
whole program will
recognize the changes.
(Specially the R.java)

RGB it use hexadecimal


value for color
combination where 0 is
white and F is black.

Linking Your Phone to Your Computer

Connect your phone to your


computer via USB. Turn on your
phone.
Select Settings > Applications >
Development and then enable
USB debugging.
USB Driver for specific handset
must be install to the computer.
http://developer.android.com/sdk/winusb.html

Dealing with a Build-in Hardware (Camera)

Android File System


Your data storage options are the
following:
Shared Preferences : Store private
primitive data in key-value pairs.
Internal Storage : Store private
data on the device memory.
External Storage : Store public
data on the shared external storage.
SQLiteDatabases : Store structured
data in a private database.
50

Some of the upcoming challenges,


impossible?

Personal health monitoring


Wireless Home Automation
Wireless Android Controlled Robot
Industrial Appliances Control
Environment Sensing
Smart Home System For Disabled
People

Nope, nothing is impossible

erwinyo@yahoo.com

Das könnte Ihnen auch gefallen