Agenda. The Android GUI Framework Introduction Anatomy A real word example Life cycle Findings

Similar documents
Mobila applikationer och trådlösa nät, HI1033, HT2012

Applications. Marco Ronchetti Università degli Studi di Trento

Embedded Systems Programming - PA8001

Android for Java Developers Dr. Markus Schmall, Jochen Hiller

Real-Time Embedded Systems

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

INTRODUCTION TO ANDROID

Android Application Development

Getting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Security model. Marco Ronchetti Università degli Studi di Trento

App Development for Android. Prabhaker Matet

Mobila applikationer och trådlösa nät, HI1033, HT2013

SHWETANK KUMAR GUPTA Only For Education Purpose

Android Application Model I

Introduction To Android

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?

COLLEGE OF ENGINEERING, NASHIK-4

Learn about Android Content Providers and SQLite

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.

Android Overview. Most of the material in this section comes from

Solving an Android Threading Problem

Android Development Tutorial. Yi Huang

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android

BCA 6. Question Bank

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Table of content. Introduction to Android. Members of OHA.. A look of OHA on Android.

Android Beginners Workshop

Android Programming Lecture 2 9/7/2011

Computer Science E-76 Building Mobile Applications

Introduction to Android

A Crash Course to Android Mobile Platform

Introduction to Android

Android UI Development

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ]

User Interface Design & Development

Preview from Notesale.co.uk Page 6 of 337

Lab 1: Getting Started With Android Programming

Mobile Application Development - Android

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

Vienos veiklos būsena. Theory

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Android Programming (5 Days)

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Android Services. Victor Matos Cleveland State University. Services

Android" Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition

Simple Currency Converter

Android Programmierung leichtgemacht. Lars Vogel

Android Ecosystem and. Revised v4presenter. What s New

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android Workshop: Model View Controller ( MVC):

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application.

Introduction to Android

Android App Development

Xin Pan. CSCI Fall

EMBEDDED SYSTEMS PROGRAMMING Android NDK

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

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

Mobile and Wireless Systems Programming

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

1. What are the key components of Android Architecture? 2. What are the advantages of having an emulator within the Android environment?

Android HelloWorld - Example. Tushar B. Kute,

CS260 Intro to Java & Android 04.Android Intro

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

COSC 3P97 Mobile Computing

Android Application Development. By : Shibaji Debnath

Manifest.xml. Activity.java

Developer s overview of the Android platform

Mobile Application Development

M O B I L E T R A I N I N G. Beginning Your Android Programming Journey

EMBEDDED SYSTEMS PROGRAMMING Android Services

An Overview of the Android Programming

Embedded Systems Programming - PA8001

Mobile Programming Lecture 1. Getting Started

Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento

ES E 3 3 L a L b 5 Android development

Configuring the Android Manifest File

UNDERSTANDING ACTIVITIES

Building MyFirstApp Android Application Step by Step. Sang Shin Learn with Passion!

Tutorial: Setup for Android Development

Around Android. Essential Android features illustrated by a walk through a practical example

Android Software Development Kit (Part I)

MC Android Programming

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

ECOM 5341 Mobile Computing(Android) Eng.Ruba A. Salamah

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location.

Introduction to Android Android Smartphone Programming. Outline University of Freiburg. What is Android? Background University of Freiburg.

14.1 Overview of Android

Android Data Storage

EMBEDDED SYSTEMS PROGRAMMING Android NDK

Arrays of Buttons. Inside Android

Transcription:

The Android GUI Framework Java User Group Switzerland May 2008 Markus Pilz mp@greenliff.com Peter Wlodarczak pw@greenliff.com Agenda 1. 1. Introduction 2. 2. Anatomy 3. 3. A real word example 4. 4. Life cycle 5. 5. Tools 6. 6. Findings

The Google Phone Not a phone, but a software platform Open Handset Alliance Mobile operators Handset manufacturer Esmertec Noser... There will be many devices... But there is already an SDK Why Android Full phone software stack including applications Designed as a platform for software development Android is open Android is free Community support Tool support 100% Java Phone

Android Platform Java 1.5 support Android GUI GUI is fully written in Java but it is not AWT / Swing and neither J2ME LCDUI Widget toolkit XML based GUI (Touch) screen Might have a keyboard

Android Widget-Set Anatomy I Activity Intent, IntentFilter, IntentReceiver View Service Content Provider

Activities and Screens Application consist of independent Screens Includes resources and an XML manifest which describes and configures the screens Each screen can open other screens in the same or another application Screens are called Activities Activity Backed by a single Java class Handles events, displays UI, performs functions Lives according to a predefined life cycle (like applets) Creates an Intent to call another Activity Intent, IntentFilter, IntentReceiver Calling Activity populates Intent Data to process Action to perform on it MIME type of the data Handler class Android searches the most suitable application to handle the request Based on the XML manifest Handler class if caller wants control

Content Providers and Services Applications can expose private date by implementing a public service called Content Provider Standard methods to store and retrieve type of data Image-, audio, video, contacts,... Respond to single requests Services Run in the background to perform long tasks such a music playback A real word example I A translater for Android If you are in a country where no one understands your language You cannot read anything You have your mobile phone always with you No aditional device needed

A real word example II Uses the google translator Uses XMPP for data transmission Can be extended with new languages Adaptive GUI GUI fully defined in XML Uses camera input and OCR A real word example III Lets see it

A real word example IV Used Eclipse for development ANT script and make for build Uses persistence of user data Uses touch screen and keyboard input A real word example V The AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.greenliff.translator"> <application android:icon="@drawable/logo"> <activity android:label="@string/settings" android:name="settings"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> <activity android:label="@string/app_name" android:name="translate"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:label="@string/ocr" android:name="ocr"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> </application> </manifest>

A real word example V The AndroidManifest.xml Activity <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.greenliff.translator"> <application android:icon="@drawable/logo"> <activity android:label="@string/settings" android:name="settings"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> <activity android:label="@string/app_name" android:name="translate"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:label="@string/ocr" android:name="ocr"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> </application> </manifest> Activity A real word example V The AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.greenliff.translator"> <application android:icon="@drawable/logo"> <activity android:label="@string/settings" android:name="settings"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> <activity android:label="@string/app_name" android:name="translate"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:label="@string/ocr" android:name="ocr"> <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> </application> </manifest> Launch

A real word example VI The AndroidManifest.xml Used for security Define permissions, e. g. <uses-permission android:name="android.permission.receive_sms" /> Give other Activities access A real word example VII An XML snipped of the main Activity <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linlayout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" Text reference android:background="@drawable/blue" android:text="@string/translate_to_1"/> <EditText android:id="@+id/totranslate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:layout_below="@id/linlayout android:hint="type here..." />...

A real word example VII An XML snipped of the main Activity <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linlayout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" Text reference android:background="@drawable/blue" android:text="@string/translate_to_1"/> <EditText android:id="@+id/totranslate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:layout_below="@id/linlayout android:hint="type here..." />... Id A real word example VIII Could also be developed purely in Java XML cannot be debugged Not all the attributes can be defined in XML

A real word example IX A code snipped of the Translate Activity @Override public void oncreate(bundle icicle) { super.oncreate(icicle); Window wp = getwindow(); mcontext = wp.getcontext(); settheme(android.r.style.theme_light); setcontentview(r.layout.main); mlayout = (LinearLayout) this.findviewbyid(r.id.linlayout); mtotranslate = (EditText) this.findviewbyid(r.id.totranslate); setshowlanguages();... menge = (LinearLayout) this.findviewbyid(r.id.enge); LANGUAGE_LAYOUT[0] = menge; de2en = (Button) this.findviewbyid(r.id.de2en); de2en.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { if(!connect()) { notloggedinalert(); else { doconnect("de2en@bot.talk.google.com"); rearrange(menge); ); Set layout A real word example IX A code snipped of the Translate Activity @Override public void oncreate(bundle icicle) { super.oncreate(icicle); Window wp = getwindow(); mcontext = wp.getcontext(); settheme(android.r.style.theme_light); setcontentview(r.layout.main); mlayout = (LinearLayout) this.findviewbyid(r.id.linlayout); mtotranslate = (EditText) this.findviewbyid(r.id.totranslate); setshowlanguages();... menge = (LinearLayout) this.findviewbyid(r.id.enge); LANGUAGE_LAYOUT[0] = menge; de2en = (Button) this.findviewbyid(r.id.de2en); de2en.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { if(!connect()) { notloggedinalert(); else { doconnect("de2en@bot.talk.google.com"); rearrange(menge); );

Set layout A real word example IX A code snipped of the Translate Activity @Override public void oncreate(bundle icicle) { super.oncreate(icicle); Window wp = getwindow(); mcontext = wp.getcontext(); settheme(android.r.style.theme_light); setcontentview(r.layout.main); mlayout = (LinearLayout) this.findviewbyid(r.id.linlayout); mtotranslate = (EditText) this.findviewbyid(r.id.totranslate); setshowlanguages(); Find elements... menge = (LinearLayout) this.findviewbyid(r.id.enge); LANGUAGE_LAYOUT[0] = menge; de2en = (Button) this.findviewbyid(r.id.de2en); de2en.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { if(!connect()) { notloggedinalert(); else { doconnect("de2en@bot.talk.google.com"); rearrange(menge); ); Set layout A real word example IX A code snipped of the Translate Activity @Override public void oncreate(bundle icicle) { super.oncreate(icicle); Window wp = getwindow(); mcontext = wp.getcontext(); settheme(android.r.style.theme_light); setcontentview(r.layout.main); mlayout = (LinearLayout) this.findviewbyid(r.id.linlayout); mtotranslate = (EditText) this.findviewbyid(r.id.totranslate); setshowlanguages(); Find elements Add behavior... menge = (LinearLayout) this.findviewbyid(r.id.enge); LANGUAGE_LAYOUT[0] = menge; de2en = (Button) this.findviewbyid(r.id.de2en); de2en.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { if(!connect()) { notloggedinalert(); else { doconnect("de2en@bot.talk.google.com"); rearrange(menge); );

A real word example X Call an other Activity @Override public boolean onoptionsitemselected(menu.item item) { switch (item.getid()) { case 0: showlogin(); break; case 1: Intent intent = new Intent(Translate.this, Settings.class); intent.putextras(mshownlanguages); startsubactivity(intent, SETTINGS); break; // switch return true; A real word example X Call an other Activity Start an Activity @Override public boolean onoptionsitemselected(menu.item item) { switch (item.getid()) { case 0: showlogin(); break; case 1: Intent intent = new Intent(Translate.this, Settings.class); intent.putextras(mshownlanguages); startsubactivity(intent, SETTINGS); break; // switch return true;

A real word example X Call an other Activity Start an Activity @Override public boolean onoptionsitemselected(menu.item item) { switch (item.getid()) { case 0: showlogin(); break; case 1: Intent intent = new Intent(Translate.this, Settings.class); intent.putextras(mshownlanguages); startsubactivity(intent, SETTINGS); break; // switch return true; Pass data to new Activity A real word example XI Store user data @Override protected void onpause() { super.onpause(); SharedPreferences.Editor ed = mprefs.edit(); for(int i = 0; i < SUPPORTED_LANGUAGES.length; i++) { ed.putboolean(supported_languages[i], mshownlanguages.getboolean(supported_languages[i])); ed.commit(); Persistent store

A real word example XII Preferences Store user data Database Files Content provider Network Life cycle Life cycle not directly controlled by application System can kill an application to free up memory Controll through oncreate(), onpause(), onstop()... methods Android has different types of processes, visible processes, service processes, background processes... Services can be used for longe-lived background processes

Tools I The Android SDK comes with a ADT (Android Development Tools) plugin for Eclipse Android has two debuggers, adb, ddms adb (Android Debug Bridge) install, shell, log dump ddms (Dalvik Debug Monitor Server) Android has on device debugging But currently no devices available Android has a packager, aapk Tools II javac dex *.java *.class *.dex aapk *.apk adb run

Tools III Android has an emulator with different skins Hardware support is very limited No messaging and call support Other IDEs can be used javac 1.5 and 1.6 are supported activitycreator.py creates AndroidManifest.xml, build.xml and directory structure Applications aren t signed (yet) Findings Android uses proven technology like Java, XML and Linux It offers a rich API for application development There is an initial learning effort Android doesn t have many of the limitations of current mobile platforms Android is still in beta Android development is fun

Thank you for the attention Questions? Find out more at: http://code.google.com/android