MMI 2: Mobile Human- Computer Interaction Android



Similar documents
Android Introduction. Hello Mihail L. Sichitiu 1

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

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

Mobile Application Development

Chapter 2 Getting Started

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

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

Tutorial #1. Android Application Development Advanced Hello World App

Android Development. Marc Mc Loughlin

How to build your first Android Application in Windows

Developing Android Apps: Part 1

App Development for Android. Prabhaker Matet

Introduction to Android SDK Jordi Linares

Android Environment SDK

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

Hello World. by Elliot Khazon

Developing an Android App. CSC207 Fall 2014

Android For Java Developers. Marko Gargenta Marakana

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

Android Basics. Xin Yang

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

Android Environment SDK

Introduction to Android

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

Tutorial for developing the Snake Game in Android: What is Android?

Getting Started With Android

Presenting Android Development in the CS Curriculum

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

Location-Based Services Design and Implementation Using Android Platforms

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

Android Programming Basics

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

Lecture 1 Introduction to Android

Android App Development. Rameel Sethi

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

Building Your First App

How to Create an Android Application using Eclipse on Windows 7

Getting Started: Creating a Simple App

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

Android ( ) Frank Ducrest

Android Java Live and In Action

A software stack for mobile devices:

Basics. Bruce Crawford Global Solutions Manager

4. The Android System

IOIO for Android Beginners Guide Introduction

Android Bootcamp. Elaborado (com adaptações) a partir dos tutoriais:

Android Apps Development Boot Camp. Ming Chow Lecturer, Tufts University DAC 2011 Monday, June 6, 2011

Android Tutorial. Larry Walters OOSE Fall 2011

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

Frameworks & Android. Programmeertechnieken, Tim Cocx

How to develop your own app

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

Smartphone market share

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

Based on Android 4.0. by Lars Vogel. Version 9.8. Copyright 2009, 2010, 2011, 2012 Lars Vogel Home Tutorials Trainings Books Social

Android Programming. An Introduction. The Android Community and David Read. For the CDJDN April 21, 2011

OpenCV on Android Platforms

ANDROID TUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com

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

Tutorial: Setup for Android Development

An Introduction to Android

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Developing apps for Android OS: Develop an app for interfacing Arduino with Android OS for home automation

Android Concepts and Programming TUTORIAL 1

Android Application Development. Yevheniy Dzezhyts

2. Click the download button for your operating system (Windows, Mac, or Linux).

Developing NFC Applications on the Android Platform. The Definitive Resource

Android Mobile App Building Tutorial

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

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

Open Source Telemedicine Android Client Development Introduction

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

Getting started with Android and App Engine

06 Team Project: Android Development Crash Course; Project Introduction

Android Application Development - Exam Sample

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

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

Introduction to NaviGenie SDK Client API for Android

Learning Android Marko Gargenta

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

Lab 1 (Reading Sensors & The Android API) Week 3

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)

Mocean Android SDK Developer Guide

Jordan Jozwiak November 13, 2011

Android Development Tutorial

2. Installieren des MySQL Workbench (Version ) 3. Unter Database > Manage Connection folgende Werte eintragen

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

Create Your Own Android App Tools Using ArcGIS Runtime SDK for Android

Transcription:

MMI 2: Mobile Human- Computer Interaction Android Prof. Dr. michael.rohs@ifi.lmu.de Mobile Interaction Lab, LMU München

Android Software Stack Applications Java SDK Activities Views Resources Animation Telephony Content Providers OpenGL Camera SQLite Native Libraries Android Runtime Media OpenGL FreeType Linux Kernel, version 2.6 SQLite WebKit Graphics Dalvik VM Device Drivers Resource Access Power Management 2

Android Characteristics Activity Activities are the components of an application Represent a logical unit of user action Typically represented by a screen containing views Can be invoked externally Declarative UI definition XML files specify user interface resources Resources (layout definitions, strings, bitmaps) Separation of code and user interface Teachable Clear semantics of Java, clear design & concepts, good emulator 3

Installing Android

Android Resources Android developer pages (platform documentation) http://developer.android.com 5

Required Software Java JDK 6, Standard Edition (not only JRE) http://java.sun.com/javase/downloads/index.jsp Eclipse IDE (3.4 or newer) http://www.eclipse.org/downloads/ Eclipse IDE for Java Developers Android SDK starter package (depending on your platform) http://dl.google.com/android/android-sdk_r08-windows.zip http://dl.google.com/android/android-sdk_r08-mac_86.zip http://dl.google.com/android/android-sdk_r08-linux_86.tgz See also: Quick Steps http://developer.android.com/sdk/index.html 6

Installation Start Eclipse In Eclipse: Install Android SDK Menu: Help, Install New Software https://dl-ssl.google.com/android/eclipse/ Point Eclipse to the Android SDK starter package Menu: Window, preferences, Android, SDK Location /soft/ifi/lang/android-sdk-r10/ix86-unknown-linux In Eclipse: Android SDK and AVD Manager Window / Android SDK and AVD Manager New... / Virtual Devices / 2.2 (oder 1.6) mit Google API Mobile Phone Anwendungen, Entwicklung: USB-Debugging,... 7

In Eclipse: Install New Software... Android Plugin https://dl-ssl.google.com/android/eclipse/ 8

Set Path to Android SDK Starter Package 9

Define Android Virtual Device 10

Hello World

Creating Your First Android Project File à New Project à Android à Android Project 12

Uniquely identifies the application! 13

14

15

16

17

Exercise: Install Android + Create Hello World 18

19

Declarative definition of UIs main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 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> 20

Separating text strings from source code strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">hello World, MainActivity!</string> <string name="app_name">hello Android</string> </resources> Default language in res/values/strings.xml Localized languages in res/values-xx ß language qualifier French in res/values-fr/strings.xml Hindi in res/values-hi/strings.xml etc. 21

R.java /* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ Never ever edit R.java!!! package de.tuberlin.tlabs; public final class R { public static final class attr { public static final class drawable { public static final int icon=0x7f020000; public static final class id { public static final int Button01=0x7f050000; public static final class layout { public static final int main=0x7f030000; public static final class string { public static final int Button01=0x7f040002; public static final int app_name=0x7f040001; public static final int hello=0x7f040000; 22

23

24

Declarative Definition of UIs main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 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" /> <Button android:text="@string/button01" android:id="@+id/button01" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> 25

strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">hello World, MainActivity!</string> <string name="app_name">hello Android</string> <string name="button01">click me now!</string> </resources> 26

27

Handling Button Click Events XML <Button android:id="@+id/button1" android:text="basic Button" android:layout_width="wrap_content" android:layout_height="wrap_content" /> Java public class MainActivity extends Activity implements View.OnClickListener { public void oncreate(bundle savedinstancestate) {... Button b = (Button) findviewbyid(r.id.button1); b.setonclicklistener(this); private int counter = 0; public void onclick(view v) { Button b = (Button)v; b.settext("counter = " + (++counter)); 28

Exercise: Add a button to Hello World 29

UI from XML resources MainActivity.java import android.app.activity; import android.os.bundle; public class MainActivity extends Activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); 30

UI programmatically defined MainActivity.java import android.app.activity; import android.os.bundle; import android.widget.textview; public class MainActivity extends Activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.main); TextView tv = new TextView(this); tv.settext("hello World (TextView)!"); setcontentview(tv); XML resource <TextView...> Java object android.widget.textview 31

Touch Input: MotionEvent Method View.onTouchEvent(MotionEvent e) Motion event data x, y, time, action, source, pressure, size Sources depend on hardware Mouse, pen, finger, trackball Actions ACTION_DOWN ACTION_MOVE ACTION_UP ACTION_CANCEL Motion history Sequence of coordinates between events 32

Touch Input Painting public class TouchPaint extends Activity { private MyView myview; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); myview = new MyView(this); setcontentview(myview); 33

Touch Input Painting public class MyView extends View { private final Paint paint = new Paint(); private int x = 0, y = 0; public MyView(Context c) { super(c); paint.setargb(255, 255, 255, 255); protected void ondraw(canvas c) { c.drawcircle(x, y, 3, paint); public boolean ontouchevent(motionevent e) { x = (int)e.getx(); y = (int)e.gety(); invalidate(); return true; 34

Concepts so far Project directory structure src, gen, res, AndroidManifest.xml Resources Declarative view definitions in XML Localization of string resources Resource identifiers Touch input Motion events 35