Android Development. Marc Mc Loughlin

Similar documents
Chapter 2 Getting Started

Introduction to Android: Hello, Android! 26 Mar 2010 CMPT166 Dr. Sean Ho Trinity Western University

Android For Java Developers. Marko Gargenta Marakana

Jordan Jozwiak November 13, 2011

Mobile Application Development

MMI 2: Mobile Human- Computer Interaction Android

Android Application Development

Android Basics. Xin Yang

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Android Environment SDK

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Smartphone market share

Android Application Development - Exam Sample

Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources. Recap: TinyOS. Recap: J2ME Framework

Getting Started: Creating a Simple App

Tutorial #1. Android Application Development Advanced Hello World App

Introduction to Android Programming (CS5248 Fall 2015)

Android Development. 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系

Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development.

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Android Environment SDK

OpenCV on Android Platforms

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Hello World. by Elliot Khazon

Android Concepts and Programming TUTORIAL 1

Android Development Tutorial. Human-Computer Interaction II (COMP 4020) Winter 2013

Android 多 核 心 嵌 入 式 多 媒 體 系 統 設 計 與 實 作

directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

How To Develop Android On Your Computer Or Tablet Or Phone

Android Application Development: Hands- On. Dr. Jogesh K. Muppala

Frameworks & Android. Programmeertechnieken, Tim Cocx

Android Tutorial. Larry Walters OOSE Fall 2011

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

An Introduction to Android

Building Your First App

Running a Program on an AVD

Introduction to Android

Introduction to Android SDK Jordi Linares

App Development for Smart Devices. Lec #2: Android Tools, Building Applications, and Activities

How to Create an Android Application using Eclipse on Windows 7

How to develop your own app

Android Programming and Security

ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI /19/14 HANNAH MILLER

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 2 Android Platform. Marco Picone

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

An Introduction to Android. Huang Xuguang Database Lab. Inha University

Developing NFC Applications on the Android Platform. The Definitive Resource

ITG Software Engineering

Lecture 1 Introduction to Android

Getting started with Android and App Engine

Developing an Android App. CSC207 Fall 2014

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Introduction to Android

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Developing Android Apps: Part 1

Android App Development. Rameel Sethi

Android Setup Phase 2

Fahim Uddin 1. Java SDK

Basics. Bruce Crawford Global Solutions Manager

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Presenting Android Development in the CS Curriculum

Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen,

4. The Android System

Q1. What method you should override to use Android menu system?

Android Geek Night. Application framework

06 Team Project: Android Development Crash Course; Project Introduction

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

Getting Started With Android

Android Introduction. Hello Mihail L. Sichitiu 1

Android Programming Basics

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

Mobile Application Development 2014

Android Application Development Lecture Notes INDEX

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

AndroLIFT: A Tool for Android Application Life Cycles

Login with Amazon Getting Started Guide for Android. Version 2.0

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Creating and Using Databases for Android Applications

How to build your first Android Application in Windows

TUTORIALS AND QUIZ ANDROID APPLICATION SANDEEP REDDY PAKKER. B. Tech in Aurora's Engineering College, 2013 A REPORT

IOIO for Android Beginners Guide Introduction

Developing In Eclipse, with ADT

Transcription:

Android Development Marc Mc Loughlin

Android Development Android Developer Website:h:p://developer.android.com/ Dev Guide Reference Resources Video / Blog SeCng up the SDK h:p://developer.android.com/sdk/ installing.html Install Eclipse Download SDK Set system PATH to point to C:<path to sdk>\tools Allow shell wide access to SDK tools Android Emulator adb, etc Install the Android Development Tools (ADT) Plugin Windows: Install USB driver to connect to external device

Development Tools ADT Lets you access development tools from Eclipse Provides Android Project wizard, exports your project to APK Allows you to create an Android Virtual Device (AVD) AVD Device configurayon that lets you model device specificayons Hardware (memory) Android OS version Storage Created using either the ADT or the android tool (SDK- directory/tools/) Runs on the Emulator

Development Tools Emulator Included in SDK (SDK- DIRECTORY/tools/) Load AVD configurayon to specify Android version, hardware for the emulator instance Uses disk images on development machine to simulate flash images on device Has networking capabiliyes but requires setup Android Debug Bridge (adb) Allows access to the emulator instance or Android Device Installing applicayons Copying files to and from device Provides shell to run commands on device

Android Architecture ApplicaYons Core applicayons shipped with device (email client, calendar, maps, browser, etc) All user installed applicayons ApplicaYon Framework Set of services and systems that your applicayon can use AcYvity Manager, Content providers, Resource Manager Core Libraries Subset of J2SE Android RunYme Dalvik virtual machine opymized for mobile devices Runs class files (dex files) Libraries C/C++ libraries but called through java interfaces Linux kernel Underlying operayng system

Manifest file Each applicayon runs on an individual Dalvik virtual machine inside a linux process To access other applicayons and specific parts of the API it must have permission An applicayons permissions are set in it s manifest file Manifest file: Tells the android operayng system about the applicayon Permissions Its components (AcYviYes, Services, Content Providers, etc)

Android ApplicaYon Components AcYviYes AcYvity: A window to draw user interface components on Numerous acyviyes = Task = Android App Each window is a subclass of the acyvity class Services Background processes Carries out any long process Broadcast Receivers Listens for events Receives broadcast announcements (Intents) and reacts to them (Ymezone changes, etc) Content providers Persist data SQLite database Shared preferences

Intents AcYviYes, Services and Broadcast Receivers talk to each other via Intents Intents = messages among the applicayon components Can be within your applicayon: calling an acyvity or service in your applicayon Or System wide: accessing the address book acyvity An intent contains informayon AcYon Data

Android AcYviYes

Android - AcYviYes AcYvity class Each UI Window extends the acyvity class acyvity is a frame or window to hold the GUI Each acyvity loads a view Handles user inputs AcYvity has three states AcYve or Running: AcYvity is the focus of users acyons Paused: AcYvity has lost focus but syll visible Stopped: AcYvity is completely hidden from user

AcYviYes AcYvity Manager Manages the lifecycle of acyviyes As it moves between states specific methods are called Hooks you can override to do work when the state changes Manages back stack for user navigayon

All acyviyes should implement the oncreate (Bundle) method Called every Yme an acyvity is launched This is where acyvity is iniyalised Loading views CreaYng database connecyons GeCng intent informayon Nearly all acyviyes will implement the onpause() method This is where you clean up ager your acyvity Android AcYviYes

Android AcYvity User interface User Interface defined Create layouts at runyme Declare UI elements in xml and loaded as a resource (Preferred) Create UI in xml and then reference them in your code At runyme android parses the xml resource files and instanyates them Allows you to separate the presentayon from code Resources Stored in res directory in an applicayon Android applicayons have a resource table where it keeps all the resource informayon R.java file managed by ADT creates new resource ID when resource added to applicayon Types of resources Color informayon Layout (UI) informayon Strings (ApplicaYon text).

AcYviYes Declaring views Layout declared in xml Resource files Each layout must have a root view (LinearLayout) All other views are child elements of this root Loaded into acyvity by calling the setcontentview() method Each view can be given Unique idenyfiers id Instances of the view objects can be created can be captured from the layout using the findviewbyid(int) method These instances can then be used to perform operayons on the view For example: responding to user interacyons, changing content views <?xml version="1.0" encoding="up- 8"?> <LinearLayout xmlns:android="h:p://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientayon="verycal" > <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello, I am a TextView" /> <Bu:on android:id="@+id/bu:on" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello, I am a Bu:on" /> </LinearLayout> public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview.(r.layout.main_layout); Bu:on mybu:on = (Bu:on) findviewbyid(r.id.bu:on) }

AcYviYes User InteracYon Capturing events from view objects (Bu:ons, etc) Event listeners Captures user interacyon Interfaces that contains methods that are called when a user interacts This allows you to tailor what your applicayon does depending on user interacyon private OnClickListener bu:onlistener = new OnClickListener() { public void onclick(view v) { // do something when the bu:on is clicked } }; protected void oncreate(bundle savedvalues) { } Bu:on bu:on = (Bu:on)findViewById(R.id.bu:on); bu:on.setonclicklistener(bu:onlistener);...

Intents StarYng a new acyvity Intents are messages or events They can be used to interact with acyviyes, services and broad cast receivers Explicit intents Targets specific components Implicit intents EXPLICIT INTENT Intent i = new Intent(this, NextAc1vity.class); startac1vity(i); Intent intent = new Intent("com.google.zxing.client.android.SCAN");

Advice Refresh your knowledge of Java (Do some tutorials) Learn how to use the Debugger! Look at the tutorials on the Android Developer site h:p://developer.android.com/resources/tutorials/ hello- world.html h:p://developer.android.com/resources/tutorials/ views/index.html h:p://developer.android.com/resources/tutorials/ notepad/index.html