Embedded Systems Programming - PA8001

Similar documents
Real-Time Embedded Systems

UNDERSTANDING ACTIVITIES

LECTURE NOTES OF APPLICATION ACTIVITIES

Vienos veiklos būsena. Theory

Lab 1: Getting Started With Android Programming

Introduction to Android development

Computer Science E-76 Building Mobile Applications

Mobile Application Development - Android

Overview of Activities

Introduction To Android

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Activities. Repo:

Android Workshop: Model View Controller ( MVC):

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

Applications. Marco Ronchetti Università degli Studi di Trento

Android Application Development

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

Android Activities. Akhilesh Tyagi

Security model. Marco Ronchetti Università degli Studi di Trento

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

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

BCA 6. Question Bank

Solving an Android Threading Problem

Android Development Tutorial. Yi Huang

Android HelloWorld - Example. Tushar B. Kute,

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

App Development for Android. Prabhaker Matet

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

COMP4521 EMBEDDED SYSTEMS SOFTWARE

Introduction to Android

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Introduction to Android

Introduction to Android Development

Android Ecosystem and. Revised v4presenter. What s New

Mobile Application Development

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

Xin Pan. CSCI Fall

Android Programmierung leichtgemacht. Lars Vogel

Android Fundamentals - Part 1

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

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

ANDROID APPS (NOW WITH JELLY BEANS!) Jordan Jozwiak November 11, 2012

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

Embedded Systems Programming - PA8001

Android framework overview Activity lifecycle and states

CMSC436: Fall 2013 Week 3 Lab

INTRODUCTION TO ANDROID

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

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

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

Android Beginners Workshop

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

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

Activities and Fragments

COSC 3P97 Mobile Computing

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

Android App Development

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

A Crash Course to Android Mobile Platform

Mobile Programming Lecture 1. Getting Started

Have a development environment in 256 or 255 Be familiar with the application lifecycle

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

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

ANDROID SYLLABUS. Advanced Android

Android Services. Victor Matos Cleveland State University. Services

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

Introduction to Android

Manifest.xml. Activity.java

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

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

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

Android App Development

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World

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

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

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

ABSTRACT I. INTRODUCTION. E. Susmitha, M. Himabindu M.Tech Academic Assistant, IIIT Rk Valley, Rgukt, Andhra Pradesh, India

Android Overview. Most of the material in this sec5on comes from h6p://developer.android.com/guide/

States of Activities. Active Pause Stop Inactive

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

Lifecycle Callbacks and Intents

CSCU9YH Development with Android

Android development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Android

Mobile User Interfaces

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

COLLEGE OF ENGINEERING, NASHIK-4

Android Software Development Kit (Part I)

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

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

CS260 Intro to Java & Android 04.Android Intro

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

Basics of Android Operating System

UNIT:2 Introduction to Android

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

Android Application Development. By : Shibaji Debnath

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

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Transcription:

Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

Hello World! What could an Android hello world application be like?

Android 101 Download and install Android SDK (ADT Bundle) from: http://developer.android.com/sdk/

Android 101 In order to run your Hello World! app: 1. connect your Android cell-phone and enable USB debug on your device, or 2. install a virtual device.

Hello World! 1. Create a new Android Virtual Device (AVD) 2. Create a new Android application project 3. Run and see the behavior 4. Check out the res/layout and res/values

What did we see? A screens: this will be reflected in the program as an Activity. UI components: in the program these are Views.

Some code void onclick(view view) { try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } This is something a button can do when clicked! We just have to associate this function with the right button!

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } A kind of View called an EditText can be used this way!

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } An Intent has an action and some data. It is something the program can ask the OS to deliver to some app that can do this!

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent) ; } catch (Exception e) } This is where the program asks the OS to deliver the Intent.

A paradigm shift Before Large teams of programmers involved in large pieces of software following a software engineering process. Now One (or a few) programmers developing apps that do very specific things and make use of other apps for standard things. Before Big releases, including distributing to customers or retailers. Now Just distribute online or use some app market.

Smart phones actors Google Platform: Android Language: Java Development: Eclipse Apple Platform: ios Language: Objective C Development: Xcode Microsoft Platform: Windows Phone Language: C# Development: Visual Studio We choose Android because it is more open, it is easier to distribute apps and most of you are familiar with Java and Eclipse. Java libraries are available. Swing is not available, UIs are done in a different way.

The platform

Linux kernel Device drivers Process management (process creation, memory management) Interprocess communication We will not use this directly but it is important to know that each application that is started is a Linux user! So: applications run in isolation from other apps! The android runtime makes use of some services from the kernel.

Dalvik VM Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.

Applications The AndroidManifest puts together Activities Services There is no main! BroadcastReceivers ResourceProviders Intents to build an application. Layouts Drawables Values

Activities Each activity has a window to display its UI. It typically fills the screen. An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the main activity, which is presented to the user when launching the application for the first time.

Activities Activities can start each other, as a result: Started activity pushed on top of the stack, taking user focus, Starting activity stopped and remains in the stack. The Skype app Main Contacts Profile Latest

Life cycle

An application with one activity public class Quiter extends Activity{ public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.main); Button q = (Button)findViewById(R.id.quitButton); } } q.setonclicklistener( new Button.OnClickListener(){ public void onclick(view view){ finish(); }});

The AndroidManifest (generated automatically!) <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="...> <application android:label="@string/app_name" android:icon="@drawable/icon"> <activity android:name="quiter" android:label="@string/app_name"> <intent-filter> <action android:name= "android.intent.action.main" /> <category android:name= "android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>

The resources: main layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="... android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/quitbutton" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/quittext" /> </LinearLayout>

The resources: string values <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">quitter</string> <string name="quittext">stop this!</string> </resources>

The resources: drawables res/drawable-hdpi/icon.png

Exploring the life cycle We implement all the methods that are called by the system: public class Quitter extends Activity{ public void oncreate(bundle savedinstancestate){...} public void onpause(){...} public void onstop(){...} public void ondestroy(){...} public void onresume(){...} public void onstart(){...} public void onrestart(){...} } Don t forget to call super.onsomething before doing other stuff when you override these methods!

Exploring the life cycle We can use android.util.log to produce debugging messages in the development terminal. public void onresume(){ super.onresume(); Log.d("quitter", "onresume"); } public void onstart(){ super.onstart(); Log.d("quitter", "onstart"); } public void onrestart(){ super.onrestart(); Log.d("quitter", "onrestart"); }