This document provides an introduction and overview of Android programming. It discusses what Android is, how it works, and its architecture. It also covers the Android SDK, Android Development Tools (ADT) plugin for Eclipse, and Android Native Development Kit (NDK). The document explains how to set up a development environment, start a new Android project, and run and debug apps. It provides details on project structure and outlines an example exercise to create login fields and buttons in an app.
4. Android Programming
Overview
What is Android?
A free, open source mobile platform
A Linux-based, multiprocessing, multithreaded OS
It’s not even limited to phones - you could
a DVR, a handheld GPS, an MP3 player, etc.
Android programming
Based on Java
Only one window
Supporting different screen sizes
Limited System Resources
4
6. Android Programming
Overview
Android’s versions with their releasing date
Android 1.5 Cupcake – Release Date: April 30, 2009
Android 1.6 Donut - Release Date: September 15, 2009
Android 2.0/2.1 Éclair – Release Date: October 26, 2009
Android 2.2 Froyo – Release Date: May 20, 2010
Android 2.3 Gingerbread - Release Date: December 6, 2010
Android 3.0 Honeycomb - Release Date: February 22, 2011
Android 4.0 Ice Cream Sandwich - Release Date: October 19,
2011
Android 4.1 Jelly Bean - Release Date: July 9, 2012.
6
7. Android Programming
Overview
Features
Integrated browser based on the open source WebKit engine
Optimized graphics powered by a custom 2D graphics library;
3D graphics based on the OpenGL ES 1.0 specification
(hardware acceleration optional).
SQLite for structured data storage
Media support for common audio, video, and still image formats
(MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
Bluetooth, EDGE, 3G, and Wi-Fi (hardware dependent)
Camera, GPS, compass, and accelerometer (hardware
dependent)
7
10. Android Programming
Overview
What is ADT?
Android Development Tools (ADT) is a plugin for the Eclipse IDE
that is designed to give you a powerful, integrated environment
in which to build Android applications.
http://developer.android.com/tools/sdk/eclipse-adt.html
What is SDK?
The Android SDK provides you the API libraries and developer
tools necessary to build, test, and debug apps for Android.
http://developer.android.com/sdk/index.html
10
11. Android Programming
Overview
What is NDK?
The NDK is a toolset that allows you to implement parts of your
app using native-code languages such as C and C++. For
certain types of apps, this can be helpful so that you may reuse
existing code libraries written in these languages and possibly
increased performance.
http://developer.android.com/tools/sdk/ndk/index.html
11
13. Android Programming
Resources you will need
Beginning Android 1
Window/Mac/Linux
Beginning Android 2
Android SDK
Pro Android
Eclipse
(Apress)
ADT
Software Textbook
PC or Laptop
Android Phone
Hardware
13
22. Android Programming
Project Structure
Inside the Manifest
Here is where you declare what is inside your application—the
activities, the services, and so on.
When you create your application, you will get a starter manifest
generated for you.
Underneath the manifest element, you will find the following:
• uses-permission
• permission
• Instrumentation
• uses-library
• uses-sdk
22
24. Android Programming
Running and Debugging
Create a new Android Virtual Device (AVD) if you do
not have any.
From the Window menu, select AVD Manager
From the AVD Manager window, click New button
Input
• Name: API-16
• Target: Android 4.1 – API Level 16
• Size: 50 MB
• Built-in: Default (WVGA800)
Click Create AVD button
24
25. Android Programming
Running and Debugging
From the Run menu, select Run or Debug
If you’ve using the ADT plug-in, running or
debugging your application:
Compiles the current project and converts it to an Android
executable (.dex).
Packages the executable and external resources into Android
package (.apk).
Starts the emulator (if it’s not already running).
Installs your application onto the emulator.
Start your application.
25