Survey							
                            
		                
		                * Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Agenda
What is Android?
The Android Architecture
Android Development Environment
Your First Android Application
What is Android?
An operating system running on mobile
devices.
In 2005, Google acquired the company
Android Inc.
In Nov 2007, the Open Handset Alliance is
formed for the development of Android.
– Lead by Google
– Early members include T-Mobile, HTC,
Qualcomm, Motorola
– As of June 2011, there are 81 members
Open Handset Alliance
The Open Handset Alliance is a group of …
technology and mobile companies who have
come together to accelerate innovation in
mobile and offer consumers a richer, less
expensive, and better mobile experience.
Together we have developed Android, the first
complete, open, and free mobile platform.
www.openhandsetalliance.com
The Android Architecture
Android is a software stack that includes
four layers:
–
–
–
–
Operating system kernel (Linux)
System Libraries and Android runtime
Application Framework
Applications
Applications Layer:
– Android ships with a set of core applications
such as an email client, calendar, contacts.
– Applications can also be developed using
the Java language with the Android SDK.
Application Framework:
– A set of rich components that allow
applications to be built easily by calling the
framework APIs.
Libraries:
– Used by various components in the
application framework
– Examples:
• SGL – the underlying 2D graphics engine
• SQLite – a lightweight relational database engine
• Media Libraries – support playback and recording
of audio and video
Android Runtime:
– Java core libraries (not all functionalities in
Java SE are supported)
– Dalvik Virtual Machine (an optimized Java
VM to cope with hardware limitations in
mobile devices)
Linux kernel:
– Android relies on Linux version 2.6 for core
system services such as security, memory
management, process management,
network stack, and driver model.
Android Development
Environment
Overview
There are 7 steps to setup your Android
development environment:
1. Installing Java JDK 6
2. Getting Eclipse IDE
3. Getting Android SDK
4. Installing Android Development Tools (ADT)
5. Configuring the ADT Plug-in
6. Adding Android Platforms
7. Creating an Android Virtual Device (AVD)
Step 1 – Installing JDK 6
Step 1 – Installing JDK 6
• Visit java.sun.com
• Download JDK
Step 1 – Installing JDK 6 (con’t)
• Select appropriate platform
• Mostly likely, Windows x86
Step 1 – Installing JDK 6 (con’t)
• Install the downloaded JDK
Step 2 – Getting Eclipse IDE
Step 2 – Getting Eclipse IDE
•
•
•
•
Visit www.eclipse.org
Download “Eclipse IDE for Java Developers”
Extract the zip file
Simply click the icon
to start it.
Step 3 – Getting Android SDK
Step 3 – Getting Android SDK
•
•
•
•
Visit developer.android.com/sdk
Download the Android SDK
Extract the zip file
Write down the pathname
e.g. c:\android-sdk-windows
Step 4 – Installing ADT
Step 4 – Installing ADT
•
•
•
•
Start Eclipse
Then select Help → Install New Software
Click the Add… button
In the Add Repository dialog, enter
Name and Location
Name:
ADT Plugin
Location:
https://dl-ssl.google.com/android/eclipse
• Click OK
Step 4 – Installing ADT (con’t)
• In the Available Software dialog,
select the checkbox of Developer Tools
• Click Next >
• In the Install Details dialog, click Next >
Step 4 – Installing ADT (con’t)
• Accept the license agreements
• Click Finish
• Once the installation is done,
you will be asked to restart Eclipse
• Click Restart Now
Step 5 – Configuring ADT Plug-in
Step 5 – Configuring ADT Plug-in
• Select Window → Preferences
• Select Android from the left panel
• Enter the SDK location in the main panel
e.g. c:\android-sdk-windows
• Click Apply
• Click
OK
Step 6 – Adding Android Platforms
Step 6 – Adding Android Platforms
• Select Window → Android SDK and AVD Manager
• Select Available Packages on the left panel
• Expand Android Repository
•
•
•
•
•
Expand Third party Add-ons
Select the desired components
Click Install Selected
Accept the license
Click Install
Step 7 – Creating an AVD
Step 7 – Creating an AVD
• Select
Window → Android SDK and AVD Manager
• Select Virtual Devices on the left panel
• Click New…
Step 7 – Creating an AVD (con’t)
• Type the name of the AVD,
such as “MyAVD”
• Choose the Android platform target
e.g. Android 2.3.3 – API Level 10
• Ignore the rest of the fields
• Click Create AVD
• The AVD is listed.
Your 1st Android Application
•
•
•
•
From Eclipse, select File → New → Project
In the “Select a wizard” dialog, expand Android
Select Android Project
Click Next
• Fill in the project details:
Project name:
Application name:
Package name:
Create Activity:
HelloAndroid
My First Android Program
com.exercise.android
HelloAndroid
• Select a Build Target, example:
Platform: Android 2.3.3 (API Level 10)
• Ignore the other fields
• Click Finish
• Your Android project is now ready.
• It should be visible in the Package Explorer.
• For now, neglect details on project structure.
3 ways to execute:
1. Click the run icon
2. Select Run → Run
3. Right click the project in Package Explorer,
then Run As → Android Application
Automatic Target Mode: launching new emulator with compatible AVD 'MyAVD‘
Launching a new emulator with Virtual Device 'MyAVD'
New emulator found: emulator-5554
Waiting for HOME ('android.process.acore') to be launched...
WARNING: Application does not specify an API level requirement!
Device API version is 10 (Android 2.3.3)
HOME is up on device 'emulator-5554‘
Uploading HelloAndroid.apk onto device 'emulator-5554'
Installing HelloAndroid.apk...
Success!
Starting activity com.exercise.android.HelloAndroid on device emulator-5554
HelloAndroid.java
package com.exercise.android;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Fill in the project
details:
Project name:
HelloAndroid
Application name: My First Android Program
<?xml version="1.0" encoding="utf-8"?>
Package name:
com.exercise.android
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Create Activity:
HelloAndroid
main.xml
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloAndroid!</string>
<string name="app_name">My First Android Program</string>
</resources>
Bye!