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

Similar documents
BEGIN ANDROID JOURNEY IN HOURS

Android Development. Marc Mc Loughlin

Android Basics. Xin Yang

MMI 2: Mobile Human- Computer Interaction Android

Android Java Live and In Action

Introduction to Android SDK Jordi Linares

Tutorial #1. Android Application Development Advanced Hello World App

4. The Android System

@ME (About) Marcelo Cyreno. Skype: marcelocyreno Linkedin: marcelocyreno Mail:

Frameworks & Android. Programmeertechnieken, Tim Cocx

Chapter 2 Getting Started

How to develop your own app

Building Your First App

Developing Android Apps: Part 1

Mobile Application Development 2014

ELET4133: Embedded Systems. Topic 15 Sensors

Mobile Application Development Android

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

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

Getting Started: Creating a Simple App

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

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

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

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

Presenting Android Development in the CS Curriculum

Introduction to Android Programming (CS5248 Fall 2015)

Backend as a Service

23442 ECE Introduction to Android Mobile Programming ECE Special Topics: Android Mobile Programming

TUTORIAL. BUILDING A SIMPLE MAPPING APPLICATION

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Android Programming Basics

Android App Development. Rameel Sethi

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

Basics of Android Development 1

Lecture 1 Introduction to Android

Mobile Application Development

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

How To Develop Android On Your Computer Or Tablet Or Phone

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

Android Introduction. Hello Mihail L. Sichitiu 1

Android Developer Fundamental 1

Developing NFC Applications on the Android Platform. The Definitive Resource

OpenCV on Android Platforms

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

Creating a List UI with Android. Michele Schimd

ITG Software Engineering

Android For Java Developers. Marko Gargenta Marakana

Android Environment SDK

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Android Basic XML Layouts

Developing an Android App. CSC207 Fall 2014

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

Android Concepts and Programming TUTORIAL 1

ODROID Multithreading in Android

Running a Program on an AVD

Android Environment SDK

Hello World. by Elliot Khazon

Smartphone market share

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

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

Jordan Jozwiak November 13, 2011

Android Application Development Lecture Notes INDEX

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

Programming Android applications: an incomplete introduction. J. Serrat Software Design December 2013

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

AdFalcon Android SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Android Programming and Security

IOIO for Android Beginners Guide Introduction

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

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers Try It Out

Developing Android Applications: Case Study of Course Design

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Android ( ) Frank Ducrest

Android Services. Android. Victor Matos

Login with Amazon Getting Started Guide for Android. Version 2.0

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Android Geek Night. Application framework

App Development for Android. Prabhaker Matet

Android Fundamentals 1

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

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

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

AndroLIFT: A Tool for Android Application Life Cycles

Transcription:

Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources Homework 2 questions 10/9/2012 Y. Richard Yang 1 2 Recap: TinyOS Hardware components motivated design Each component/module specifies the interfaces it provides the interfaces/modules it uses implements the functions in the declared provided interfaces event handlers in the declared used interfaces Configuration specifies the linkage among components/ modules Recap: J2ME Framework Java adaptation for mobile devices A major focus of J2ME is device heterogeneity Solution: versioning Configurations Profiles Execution model driven (triggered) handlers, who may post tasks to a FIFO task queue monitored by a task thread 3 4 Recap: J2ME MIDP Structure Recap: IOS Lifecycle callbacks - destroy d=.get(this) d.setcurrent(disp) MIDP Current able A set of commands disp.addcommand() le s adaptation for mobile devices E.g., Cocoa => Cocoa Touch KIT => UI Kit Command listener disp.setcommandlistener() 5 http://developer.apple.com/library/ios/documentation/miscellaneous/conceptual/ iphoneostechoverview/iphoneostechoverview.pdf 6 1

Recap: IOS View Controller (MVC) Structure Discussion No-fica-on and KVO will Controller Data at did count Target Outlet Delegate Ac-on What are some major differences between desktop GUI app design and mobile (phone/ tablet) GUI app design? Data source View View 7 8 Some Key Features of Mobile UI APp Limited screen real estate one thing at a time Mobile GUI Screen real-estate is limited => Focus on one thing at a time Limited resources: more dynamic system management on app life cycle give app chances to adapt, better mem management More heterogeneous display devices decoupling between display and logic 9 10 Mobile GUI Mobile GUI Workflow Screen real-estate is limited => Focus on one thing at a time lifecycle 11 2

Mobile GUI Workflow: Do One Thing Mobile GUI Workflow: Content Based on Underlining Data lifecycle lifecycle Mobile GUI Workflow: Handle s Mobile GUI Workflow: Switch to Another GUI lifecycle lifecycle Discussion Typical Design: Framework reacts to app events and invokes app lifecycle event handlers Key design points for mobile GUI app Specify app life cycle customization Specify display Specify event scheduling How to link event, display, handler, data lifecycle 17 3

How to Provide LifeCycle s? Typical Design: UI System captures UI events; and puts them in a msg queue of the app. A UI thread processes the queue class implements it Inheritance lifecycle class does not implement it Delegate Command listener 19 Example: IOS How to Provide Component s? Component class implements it Inheritance Typically a bad idea Component class does not implement it Makes reusable Delegate Command listener 10/ 4/1 2 22 Outline Admin and recap Mobile/wireless development framework GNURadio TinyOS J2ME IOS Android http://developer.android.com/index.html Android A mobile OS based on Linux Customized Linux kernel 2.6 and 3.x (Android 4.0 onwards) E.g., default no X Windows, not full set of GNU libs ly OS concepts for mobile contexts e.g., each app is considered one Linux user New key components, e.g., Binder for IPC Power management wakelock lication development framework based on Java Dalvik Virtual Machine 23 24 4

Android Architecture Android Tools Android SDK Manager (android) Android emulator Android debug bridge (adb) can connect to an Android device and start a shell on the device See http://developer.android.com/tools/workflow/index.html 25 Mapping to Android Allows external XML resource files to specify views lication Framework (Android): Key Concepts lifecycle -How to specify the customized callbacks: extend Activity class Activity View/ViewGroup (Layout) External resources -How to link the callbacks defined in view to listener/controller: View.set Listener() 28 Activity Activity: Manifest File A single, focused thing that the user can do. Creating a window to place UI views Full-screen windows, floating windows, embedded inside of another activity Typically organized as a Stack Top Activity is visible Other activities are stopped Back button to traverse the Activity Stack Long Home shows the content of the Stack To facility launching and managing Activities, each activity is announced in a manifest file Manifest the activity Instead of a hardcode string in code, defines in res/strings 5

Android Project Resources Activity: Example // MainActivity.java public class MainActivity extends Activity { public void oncreate(bundle savedinstancestate) { // savedinstancestate holds any data that may have been saved // for the activity before it got killed by the system (e.g. // to save memory) the last time super.oncreate(savedinstancestate); setcontentview( ); // set a View 31 View A view component is a building block for user interface components. Two types of views Leaf: TextView, EditText, Button, Form, TimePicker ListView (ViewGroup): LinearLayout, Relativelayout, Programmatic Usage of Views // MainActivity.java public class MainActivity extends Activity { public void oncreate(bundle savedinstancestate) { // savedinstancestate holds any data that may have been saved // for the activity before it got killed by the system (e.g. // to save memory) the last time super.oncreate(savedinstancestate); http://developer.android.com/guide/tutorials/views/index.htm TextView tv new TextView(this); tv.settext("hello! ); setcontentview(tv); Define View by XML Access View Defined by XML public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.main); TextView mytextview = (TextView)findViewById(R.id.myTextView); 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:id= @+id/mytextview android:layout_width= fill_parent android:layout_height= wrap_content android:text= Hello World, HelloWorld /> </LinearLayout> 6

External Resources Compiled to numbers and included in R.java file Hello Example See HelloStart 37 38 Android Activity Life Cycle Lifecycle Example See ActivityifeCycle 39 40 Linking Views and s/controllers Example: TipCalc onkeydown. onkeyup ontrackball ontouch registerbutton.setonclicklistener(new View.OnClickListener() { public void onclick(view arg0) {. myedittext.setonkeylistener(new OnKeyListener() { public boolean onkey(view v, int keycode, Key event) { if (event.getaction() == Key.ACTION_DOWN) if (keycode == Key.KEYCODE_DPAD_CENTER) { return true; return false; ); Set listener: public class TipCalcActivity extends Activity implements OnClickListener { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_tip_calc); Button calc = (Button)findViewById(R.id.calculate); calc.setonclicklistener(this); 42 7

Example: TipCalc : public void onclick(view arg0) { EditText amounttext = (EditText)findViewById(R.id.amount_value); // get input double amt=double.parsedouble(amounttext.gettext().tostring()); // compute output double tipd = amount * 0.15; // set UI String tipt = String.format("%.2f", tipd); TextView tiptext = (TextView)findViewById(R.id.tip_value); tiptext.settext(tipt); 43 8