Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Size: px
Start display at page:

Download "Java & Android. Java Fundamentals. Madis Pink 2016 Tartu"

Transcription

1 Java & Android Java Fundamentals Madis Pink 2016 Tartu 1

2 Agenda» Brief background intro to Android» Android app basics:» Activities & Intents» Resources» GUI» Tools 2

3 Android» A Linux-based Operating System» Announced by Google & the Open Handset Alliance Nov 2007» First device with Android 1.0 shipped in

4 Android» The primary language for writing apps is actually Java» The standard library is mainly Java 6 with a lot of Android-specific classes on top» There are 25 API versions, most apps target Android 4.4 (API 19) or higher today 4

5 VMs on Android» Dalvik - all Android versions up to 4.4, just-intime compilation added in Android version 2.2» ART - New runtime with ahead-of-time compilation, shipped with Android 5.0 and later» Both operate on DEX (Dalvik EXecutable) bytecode 5

6 Dex Bytecode» Design goals» Compilation target for.java sources» Code size» Interpreting performance» Bytecode instructions operate on registers» Many classes in a single.dex file 6

7 Dex Toolchain(s)» Dexer (dx) - transforms Java 7 bytecode (.class) to dex» Jack & Jill - Experimental direct Java compilation to dex, supports Java 8 7

8 Dex & Dalvik Example class Hello { public static void main(string[] args) { System.out.println("Hello world!"); } } 8

9 Dex & Dalvik Example $ javac Hello.java -target 1.7 -source 1.7 $ java Hello Hello world! 9

10 Dex & Dalvik Example $ javac Hello.java -target 1.7 -source 1.7 $ java Hello Hello world! $ dx --dex --output=out.dex Hello.class 10

11 Dex & Dalvik Example $ javac Hello.java -target 1.7 -source 1.7 $ java Hello Hello world! $ dx --dex --output=out.dex Hello.class $ adb push out.dex /data/local/tmp/out.dex 11

12 Dex & Dalvik Example $ javac Hello.java -target 1.7 -source 1.7 $ java Hello Hello world! $ dx --dex --output=out.dex Hello.class $ adb push out.dex /data/local/tmp/out.dex $ adb shell dalvikvm -cp /data/local/tmp/out.dex Hello Hello world! 12

13 Anatomy of an App Each app is an.apk file - a zip in disguise - with the following contents:» AndroidManifest.xml - the manifest, describes the app» classes.dex - the dex bytecode» resources.arsc - compiled Android resources» res/* - compiled layouts, PNG bitmaps, etc» assets/* - blob assets: databases, audio files, etc 13

14 Anatomy of an App» No main(string[])» Components as entry points:» Activities» Services» Broadcast receivers» Content Providers» These are defined in the AndroidManifest.xml 14

15 Android Projects» Built with Gradle!» src/main/java - Java sources» src/main/res - Android resources» src/main/androidmanifest.xml - the manifest» build.gradle - Gradle build file, describes how to build the app 15

16 Intermission all samples at 16

17 Activities 17

18 Activity» class * extends android.app.activity» Started with an Intent - a user action» Represents a screen in an application» Owns a View hierarchy (GUI objects)» Handles user input events» Instantiated by the framework» Lifecycle controlled by the framework 18

19 Activities Example - App» InboxActivity - lists all s in Inbox» View Activity - view a single » ComposeActivity - compose/send a new » LoginActivity - log the user in 19

20 Activity Lifecycle» Driven by the framework through calls to specific Activity methods» oncreate/ondestroy - activity created» onstart/onstop - activity visible» onresume/onpause - activity is "on top"» When overriding any of these, make sure to call to super! 20

21 Starting an Activity - Intents» All Activities are started by defining an Intent - an object that represents user's intentions» Sort of like a request that apps can respond to» Requires a Context instance to send the Intent to the OS» All components, including activities extend Context» Two kinds of intents - explicit and implicit 21

22 Explicit Intents public void clickhelp() { // launch HelpActivity of this app Intent i = new Intent(context, HelpActivity.class); context.startactivity(i); }» Used to launch a specific activity on the device, usually within the same app 22

23 Implicit Intents public void sendfeedback() { Uri uri = Uri.parse("mailto:jf@zeroturnaround.com"); Intent i = new Intent(Intent.ACTION_SENDTO, uri); startactivity(i); }» Used for general actions like Send , Open a webpage, Take a picture etc 23

24 Implicit Intents 24

25 Implicit Intents public void openwebpage() { Uri uri = Uri.parse(" Intent i = new Intent(Intent.ACTION_VIEW, uri); startactivity(i); } 25

26 Implicit Intents 26

27 Defining an Activity package org.zeroturnaround.jf.android; import android.app.activity; public class HelloActivity extends Activity { } 27

28 Defining an Activity package org.zeroturnaround.jf.android; import android.app.activity; import android.os.bundle; import android.widget.toast; public class HelloActivity extends Activity { protected void oncreate(bundle savedinstancestate) { // always need to call super super.oncreate(savedinstancestate); // display our message String msg = "Hello World!"; Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } } 28

29 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application> <activity android:name="org.zeroturnaround.jf.android.helloactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest> 29

30 AndroidManifest.xml The <manifest /> tag tells us that this is an app with the application ID org.zeroturnaround.jf.android <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application> <!-- components go here --> </application> </manifest> 30

31 AndroidManifest.xml The <activity /> tag declares an Activity component with the classname org.zeroturnaround.jf.android.helloactivity <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application> <activity android:name="org.zeroturnaround.jf.android.helloactivity"> <!-- optional intent filter goes here --> </activity> </application> </manifest> 31

32 AndroidManifest.xml The <intent-filter /> tag declares which implicit Intents our Activity handles, in this case it is the MAIN action under the LAUNCHER category This makes our app visible in the Launcher app <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> 32

33 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application> <activity android:name="org.zeroturnaround.jf.android.helloactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest> 33

34 34

35 More Information Activities: components/activities.html Intents: components/intents-filters.html Manifest: manifest/manifest-intro.html 35

36 Resources 36

37 37

38 Resources» Placed in src/main/res folder» Precompiled by aapt during the Gradle build» Value resources - strings, floats, integers, booleans,...» Complex resources - arrays, plurals,...» File resources - bitmaps, XMLs, drawables, layouts,... 38

39 Value Resources <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">hello</string> <string name="hello_world">hello World!</string> </resources>» Placed in src/main/res/values/<filename>.xml, where <FILENAME> can be anything, like strings.xml 39

40 Drawables» Placed in src/main/res/drawable» Can be XML (describing shapes, colours, gradients) or bitmaps» Automatically scaled by the OS 40

41 Layouts» Placed in src/main/res/layout» XML files for describing UI» More on these later :) 41

42 Accessing Resources from XML» Resources can be referenced in XML resources (including the manifest) <identifier>» A 42

43 Accessing Resources from Code» All resources get a runtime integer ID, placed in a class called R» Need to dereference through a Resources instance, obtained through a Context» Example dereferences:» getresources().getstring(r.string.app_name)» getresources().getdrawable(r.drawable.ic_launcher) 43

44 Resource Qualifiers» Resource folders can have extra qualifiers with -suffixes» values-et containing Estonian strings» Framework decides at runtime which resource to use» Also used to have custom layouts for tablets, different drawables for device densities, etc 44

45 Resource Qualifiers Resource qualifier examples:» res/layout-land for landscape layouts» res/drawable-xhdpi, res/drawable-hdpi, res/ drawable-mdpi for icons at various resolutions» res/values-et, res/values-ru for localization 45

46 Resources <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application> <!-- components go here --> </application> </manifest> 46

47 Resources <manifest xmlns:android=" package="org.zeroturnaround.jf.android" > <application android:label="hello World"> <!-- components go here --> </application> </manifest> 47

48 Resources <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">hello</string> <string name="hello_world">hello World!</string> </resources> 48

49 Resources <application android:label="hello World"> 49

50 Resources <application 50

51 Resources <application 51

52 Resources // display our message String msg = "Hello World!"; Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); 52

53 Resources // display our message String msg = getresources().getstring(r.string.hello_world); Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); 53

54 Resources 54

55 More Information Resources overview - guide/topics/resources/overview.html 55

56 GUI 56

57 GUI - Units» No absolute coordinates!» Units:» dip (dp) - density-independent pixels» sp - scaled pixels, scale with the text size» px - actual physical pixels» Even with dp the sizes of screens vary wildly 57

58 View Hierarchy» ViewGroup (container/node) and View (leaf node)» View groups lay out their children, which could be nested groups» Can be declared through code» Can be inflated from XML layouts» Use setcontentview(view root) or setcontentview(int layoutresid) to attach a hierarchy to an Activity 58

59 Views» TextView - displays text» ImageView - displays images» EditText - text input» Button - clickable TextView with various states 59

60 ViewGroups» FrameLayout - simple layouts for framing children» LinearLayout - lays views out in a single row/ column» RelativeLayout - lays views out in relation to each other with rules» ListView - scrolling a lot of similar views with caching 60

61 Views protected void oncreate(bundle savedinstancestate) { // always need to call super super.oncreate(savedinstancestate); // display our message String msg = getresources().getstring(r.string.hello_world); Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } 61

62 Views Replace our toast with a TextView // display our message String msg = "Hello World!"; TextView root = new TextView(this); root.settext(msg); setcontentview(root); 62

63 Views src/main/res/layout/hello.xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" /> 63

64 Views src/main/res/layout/hello.xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" />... and in our HelloActivity.onCreate: setcontentview(r.layout.hello); 64

65 Views 65

66 Views Add some padding with android:padding <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp" /> 66

67 Views Make the font larger with android:textsize <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp" android:textsize="32sp" /> 67

68 Views 68

69 Handling Events» Views can be given generated IDs via This will generate a unique integer accessible via R.id.someIdentifier» Use findviewbyid(int id) to find the view in code» Note! Always returns View so might need to cast 69

70 Handling Events Adding a button to our view <Button android:id="@+id/my_button" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/click" /> 70

71 Handling Events Adding a button to our view <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/hello_world" android:textsize="32sp" /> <Button android:id="@+id/my_button" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/click" /> </LinearLayout> 71

72 Handling Events We can use setonclicklistener to attach a handler to the click event setcontentview(r.layout.hello); // attach an OnClickListener to the view with id `my_button` Button mybutton = (Button) findviewbyid(r.id.my_button); mybutton.setonclicklistener(new View.OnClickListener() public void onclick(view v) { Toast.makeText(v.getContext(), R.string.click, Toast.LENGTH_SHORT).show(); } }); 72

73 Handling Events 73

74 More information Layouts: declaring-layout.html Handling events: topics/ui/ui-events.html 74

75 Tools 75

76 Android Studio in 5 minutes» The official IDE for Android development» Based on IntelliJ IDEA Community Edition» Download: index.html» Before opening any project, open Configure -> SDK Manager to download necessary SDK components for the homework 76

77 Android Studio - Configuring SDK Under the SDK Platforms tab, click Show Package Details and make sure the following items are checked in the Android 7.0 (Nougat) category:» Android SDK Platform 24» Sources for Android 24» Google APIs Intel x86 Atom System Image 77

78 Android Studio - Configuring SDK Under the SDK Tools tab, click Show Package Details and make sure the following items are checked:» under Android SDK Build-Tools» Android SDK Platform-Tools » Android SDK Tools » Intel x86 Emulator Accelerator (HAXM installer) 78

79 Android Studio - Configuring SDK With that being done, press Apply, read through and Accept both Android SDK license and Intel licenses and press Next to install the components 79

80 Android Studio in 5 minutes» Import the homework/samples folder via Open an existing Android Studio project» Find the green ' ' next to a dropdown in the toolbar» Studio will ask you to create an emulator, any emulator with the version later than (API 15) will do» Note: we've already downloaded the image for Nougat 7.0» You should see the app on the emulator \o/ 80

81 Developing with a Device» Settings -> About phone» Scroll down & tap Build number 7 times» You are now a developer!» Settings -> Developer options» Make sure USB Debugging is enabled 81

82 Gradle» Project layout similar to Maven» Instead of XML the build is defined through a Groovy DSL» No installation needed, gradlew will download Gradle for you» gradlew build - builds the project 82

83 More Information Android Studio - index.html Android and Android Studio: Getting Started (~10min video)

84 Homework 14 84

85 Homework 14 All the details are at: Due :59:59 Estonian time Do not leave this for the last minute! Help/questions: 85

86 Links Samples - Activities - Intents - Manifest - Resources overview - Layouts - Handling events - Android Studio - Android and Android Studio: Getting Started (~10min video)

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Diving into Android. By Jeroen Tietema. Jeroen Tietema, Diving into Android By Jeroen Tietema Jeroen Tietema, 2015 1 Requirements 4 Android SDK 1 4 Android Studio (or your IDE / editor of choice) 4 Emulator (Genymotion) or a real device. 1 See https://developer.android.com

More information

Android HelloWorld - Example. Tushar B. Kute,

Android HelloWorld - Example. Tushar B. Kute, Android HelloWorld - Example Tushar B. Kute, http://tusharkute.com Anatomy of Android Application Anatomy of Android Application Java This contains the.java source files for your project. By default, it

More information

Mobile Application Development - Android

Mobile Application Development - Android Mobile Application Development - Android MTAT.03.262 Satish Srirama satish.srirama@ut.ee Goal Give you an idea of how to start developing Android applications Introduce major Android application concepts

More information

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

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering Getting Started Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador 1 Goals Setting up your development environment Android Framework

More information

Introduction To Android

Introduction To Android Introduction To Android Mobile Technologies Symbian OS ios BlackBerry OS Windows Android Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers.

More information

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial Hello World Lesson 1 This work is licensed This under work a Creative is is licensed Commons under a a Attribution-NonCommercial Creative 4.0 Commons International Attribution- License 1 NonCommercial

More information

Android Application Development. By : Shibaji Debnath

Android Application Development. By : Shibaji Debnath Android Application Development By : Shibaji Debnath About Me I have over 10 years experience in IT Industry. I have started my career as Java Software Developer. I worked in various multinational company.

More information

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

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices. Group B: Assignment No 8 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: To verify the operating system name and version of Mobile devices. Problem Definition: Write a

More information

Android Development Tutorial. Yi Huang

Android Development Tutorial. Yi Huang Android Development Tutorial Yi Huang Contents What s Android Android architecture Android software development Hello World on Android More 2 3 What s Android Android Phones Sony X10 HTC G1 Samsung i7500

More information

Mobile Programming Lecture 1. Getting Started

Mobile Programming Lecture 1. Getting Started Mobile Programming Lecture 1 Getting Started Today's Agenda About the Android Studio IDE Hello, World! Project Android Project Structure Introduction to Activities, Layouts, and Widgets Editing Files in

More information

Android Application Development

Android Application Development Android Application Development Octav Chipara What is Android A free, open source mobile platform A Linux-based, multiprocess, multithreaded OS Android is not a device or a product It s not even limited

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

Introduction to Android Development

Introduction to Android Development Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,

More information

Android Workshop: Model View Controller ( MVC):

Android Workshop: Model View Controller ( MVC): Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software

More information

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

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

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

Getting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento Getting started: Installing IDE and SDK Marco Ronchetti Università degli Studi di Trento Alternative: Android Studio http://developer.android.com/develop/index.html 2 Tools behind the scenes dx allows

More information

Security model. Marco Ronchetti Università degli Studi di Trento

Security model. Marco Ronchetti Università degli Studi di Trento Security model Marco Ronchetti Università degli Studi di Trento Security model 2 Android OS is a multi-user Linux in which each application is a different user. By default, the system assigns each application

More information

COMP4521 EMBEDDED SYSTEMS SOFTWARE

COMP4521 EMBEDDED SYSTEMS SOFTWARE COMP4521 EMBEDDED SYSTEMS SOFTWARE LAB 1: DEVELOPING SIMPLE APPLICATIONS FOR ANDROID INTRODUCTION Android is a mobile platform/os that uses a modified version of the Linux kernel. It was initially developed

More information

Computer Science E-76 Building Mobile Applications

Computer Science E-76 Building Mobile Applications Computer Science E-76 Building Mobile Applications Lecture 3: [Android] The SDK, Activities, and Views February 13, 2012 Dan Armendariz danallan@mit.edu 1 http://developer.android.com Android SDK and NDK

More information

Android Beginners Workshop

Android Beginners Workshop Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 2 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 1 -recap What is Android How to develop Android applications Run & debug the applications

More information

Applications. Marco Ronchetti Università degli Studi di Trento

Applications. Marco Ronchetti Università degli Studi di Trento Applications Marco Ronchetti Università degli Studi di Trento Android Applications An Android application typically consists of one or more related, loosely bound activities for the user to interact with.

More information

Real-Time Embedded Systems

Real-Time Embedded Systems Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 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

More information

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

Software Practice 3 Before we start Today s lecture Today s Task Team organization 1 Software Practice 3 Before we start Today s lecture Today s Task Team organization Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 Lecture Schedule Spring 2017 (Monday) This schedule can be changed M A R

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2 Workshop 1. Compare different layout by using Change Layout button (Page 1 5) Relative Layout Linear Layout (Horizontal) Linear Layout (Vertical) Frame Layout 2. Revision on basic programming skill - control

More information

Android Basics. Android UI Architecture. Android UI 1

Android Basics. Android UI Architecture. Android UI 1 Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à

More information

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

Android Overview. Most of the material in this section comes from Android Overview Most of the material in this section comes from http://developer.android.com/guide/ Android Overview A software stack for mobile devices Developed and managed by Open Handset Alliance

More information

CSCU9YH Development with Android

CSCU9YH Development with Android CSCU9YH Development with Android Computing Science and Mathematics University of Stirling 1 Android Context 3 Smartphone Market share Source: http://www.idc.com/promo/smartphone-market-share/os 4 Smartphone

More information

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

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World Before you do anything read all of the following red paragraph! For this lab you

More information

Produced by. Mobile Application Development. Eamonn de Leastar

Produced by. Mobile Application Development. Eamonn de Leastar Mobile Application Development Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie A First

More information

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University User Interface: Layout Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University http://twitter.com/krunapon Agenda User Interface Declaring Layout Common Layouts User Interface

More information

App Development for Android. Prabhaker Matet

App Development for Android. Prabhaker Matet App Development for Android Prabhaker Matet Development Tools (Android) Java Java is the same. But, not all libs are included. Unused: Swing, AWT, SWT, lcdui Android Studio (includes Intellij IDEA) Android

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu Android UI Tour Home Screen First screen, includes favorites tray (e.g phone, mail, messaging, web, etc)

More information

Android Application Development 101. Jason Chen Google I/O 2008

Android Application Development 101. Jason Chen Google I/O 2008 Android Application Development 101 Jason Chen Google I/O 2008 Goal Get you an idea of how to start developing Android applications Introduce major Android application concepts Provide pointers for where

More information

Solving an Android Threading Problem

Solving an Android Threading Problem Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know

More information

Android App Development. Ahmad Tayeb

Android App Development. Ahmad Tayeb Android App Development Ahmad Tayeb Ahmad Tayeb Lecturer @ Department of Information Technology, Faculty of Computing and Information Technology, KAU Master degree from Information Sciences and Technologies,

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Alberto Monge Roffarello Politecnico di Torino, 2017/2018 Some slides and figures are taken from the Mobile Application Development (MAD) course Disclaimer

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Tip: Switching UIs THE PROBLEM How to switch from one UI to another Each UI is associated with a distinct class that controls it Solution shown: two UIs,

More information

BCA 6. Question Bank

BCA 6. Question Bank BCA 6 030010601 : Introduction to Mobile Application Development Question Bank Unit 1: Introduction to Android and Development tools Short questions 1. What kind of tool is used to simulate Android application?

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples Emmanuel Agu Android UI Design in XML Recall: Files Hello World Android Project XML file used to design Android UI

More information

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

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Lab 1: Getting Started With Android Programming

Lab 1: Getting Started With Android Programming Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Eng. Jehad Aldahdooh Mobile Computing Android Lab Lab 1: Getting Started With Android Programming To create a new Android Project

More information

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

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface? MOBILE COMPUTING CSE 40814/60814 Fall 2015 How many of you have implemented a command-line user interface? 1 How many of you have implemented a graphical user interface? HTML/CSS Java Swing.NET Framework

More information

ANDROID USER INTERFACE

ANDROID USER INTERFACE 1 ANDROID USER INTERFACE Views FUNDAMENTAL UI DESIGN Visual interface element (controls or widgets) ViewGroup Contains multiple widgets. Layouts inherit the ViewGroup class Activities Screen being displayed

More information

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

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml Android Application Written in Java (it s possible to write native code) Good

More information

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling Lecture 1 Review How to edit XML files in Android Studio? What holds all elements (Views) that appear to the user in an Activity?

More information

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

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based

More information

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

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android Ing. Elton Domnori December 7, 2011 Mobile OS Symbian BlackBerry Window mobile Android ios Mobile OS OS First release Last release Owner Android Android 1.0 September 2008 Android 4.0 May 2011 Open Handset

More information

Chapter 5 Defining the Manifest

Chapter 5 Defining the Manifest Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 5 Defining the Manifest Chapter 5 Overview Use the Android manifest file for configuring Android applications

More information

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

Agenda. The Android GUI Framework Introduction Anatomy A real word example Life cycle Findings 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

More information

Mobile Application Development

Mobile Application Development Mobile Application Development MTAT.03.262 Jakob Mass jakob.mass@ut.ee Goal Give you an idea of how to start developing mobile applications for Android Introduce the major concepts of Android applications,

More information

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

IEMS 5722 Mobile Network Programming and Distributed Server Architecture Department of Information Engineering, CUHK MScIE 2 nd Semester, 2016/17 IEMS 5722 Mobile Network Programming and Distributed Server Architecture Lecture 1 Course Introduction Lecturer: Albert C. M. Au

More information

Android Application Model I

Android Application Model I Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath Reading: Big Nerd Ranch Guide, Chapters 3, 5 (Activities);

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming Emmanuel Agu Android Apps: Big Picture UI Design using XML UI design code (XML) separate from the program (Java) Why?

More information

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH Android Basics - Bhaumik Shukla Android Application Developer @ STEALTH FLASH Introduction to Android Android is a software stack for mobile devices that includes an operating system, middleware and key

More information

ANDROID SYLLABUS. Advanced Android

ANDROID SYLLABUS. Advanced Android Advanced Android 1) Introduction To Mobile Apps I. Why we Need Mobile Apps II. Different Kinds of Mobile Apps III. Briefly about Android 2) Introduction Android I. History Behind Android Development II.

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples Emmanuel Agu Resources Android Resources Resources? Images, strings, dimensions, layout files, menus, etc that your

More information

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

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or

More information

PROGRAMMING APPLICATIONS DECLARATIVE GUIS

PROGRAMMING APPLICATIONS DECLARATIVE GUIS PROGRAMMING APPLICATIONS DECLARATIVE GUIS DIVING RIGHT IN Eclipse? Plugin deprecated :-( Making a new project This keeps things simple or clone or clone or clone or clone or clone or clone Try it

More information

Android for Java Developers Dr. Markus Schmall, Jochen Hiller

Android for Java Developers Dr. Markus Schmall, Jochen Hiller Android for Java Developers Dr. Markus Schmall Jochen Hiller 1 Who we are Dr. Markus Schmall m.schmall@telekom.de Deutsche Telekom AG Jochen Hiller j.hiller@telekom.de Deutsche Telekom AG 2 Agenda Introduction

More information

Android & iphone. Amir Eibagi. Localization

Android & iphone. Amir Eibagi. Localization Android & iphone Amir Eibagi Localization Topics Android Localization: Overview Language & Strings Country/region language variations Images & Media Currency, date & Time iphone Localization Language &

More information

Android Programming (5 Days)

Android Programming (5 Days) www.peaklearningllc.com Android Programming (5 Days) Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse tools. This Android

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu Android UI Tour Home Screen First screen after unlocking phone or hitting home button Includes favorites tray

More information

Fig. 2.2 New Android Application dialog. 2.3 Creating an App 41

Fig. 2.2 New Android Application dialog. 2.3 Creating an App 41 AndroidHTP_02.fm Page 41 Wednesday, April 30, 2014 3:00 PM 2.3 Creating an App 41 the Welcome app s TextView and the ImageViews accessibility strings, then shows how to test the app on an AVD configured

More information

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners Layouts and Views http://developer.android.com/guide/topics/ui/declaring-layout.html http://developer.android.com/reference/android/view/view.html Repo: https://github.com/karlmorris/viewsandlayouts Overview

More information

Mobile Development Lecture 8: Intents and Animation

Mobile Development Lecture 8: Intents and Animation Mobile Development Lecture 8: Intents and Animation Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Elgayyar.weebly.com 1. Multiple Activities Intents Multiple Activities Many apps have multiple activities.

More information

Android App Development

Android App Development Android App Development Outline Introduction Android Fundamentals Android Studio Tutorials Introduction What is Android? A software platform and operating system for mobile devices Based on the Linux kernel

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Emmanuel Agu What is Android? Android is world s leading mobile operating system Open source Google: Owns Android, maintains it,

More information

CS 234/334 Lab 1: Android Jump Start

CS 234/334 Lab 1: Android Jump Start CS 234/334 Lab 1: Android Jump Start Distributed: January 7, 2014 Due: Friday, January 10 or Monday, January 13 (in-person check off in Mobile Lab, Ry 167). No late assignments. Introduction The goal of

More information

Lecture 1 - Introduction to Android

Lecture 1 - Introduction to Android Lecture 1 - Introduction to Android This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/

More information

Syllabus- Java + Android. Java Fundamentals

Syllabus- Java + Android. Java Fundamentals Introducing the Java Technology Syllabus- Java + Android Java Fundamentals Key features of the technology and the advantages of using Java Using an Integrated Development Environment (IDE) Introducing

More information

Android UI: Overview

Android UI: Overview 1 Android UI: Overview An Activity is the front end component and it can contain screens. Android screens are composed of components or screen containers and components within the containers Screen containers

More information

(Refer Slide Time: 0:48)

(Refer Slide Time: 0:48) Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Lecture 10 Android Studio Last week gave you a quick introduction to android program. You develop a simple

More information

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device 1 Software Practice 3 Today s lecture Today s Task Porting Android App. in real device Prof. Hwansoo Han T.A. Jeonghwan Park 43 INTENT 2 3 Android Intent An abstract description of a message Request actions

More information

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION Course Title: Java Technologies Grades: 10-12 Prepared by: Rob Case Course Unit: What is Java? Learn about the history of Java. Learn about compilation & Syntax. Discuss the principles of Java. Discuss

More information

Multiple devices. Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers

Multiple devices. Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers Multiple devices Multiple devices Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers Create a new directory in your project's res/ and name it using the

More information

Starting Another Activity Preferences

Starting Another Activity Preferences Starting Another Activity Preferences Android Application Development Training Xorsat Pvt. Ltd www.xorsat.net fb.com/xorsat.education Outline Starting Another Activity Respond to the Button Create the

More information

EMBEDDED SYSTEMS PROGRAMMING Android NDK

EMBEDDED SYSTEMS PROGRAMMING Android NDK EMBEDDED SYSTEMS PROGRAMMING 2015-16 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code

More information

Android Programmierung leichtgemacht. Lars Vogel

Android Programmierung leichtgemacht. Lars Vogel Android Programmierung leichtgemacht Lars Vogel Twitter: @vogella Lars Vogel Arbeitet als unabhängiger Eclipse und Android Berater und Trainer Arbeit zusätzlichen für SAP AG als Product Owner in einem

More information

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism ANDROID TRAINING COURSE CONTENT SECTION 1 : INTRODUCTION Android What it is? History of Android Importance of Java language for Android Apps Other mobile OS-es Android Versions & different development

More information

CS 4330/5390: Mobile Application Development Exam 1

CS 4330/5390: Mobile Application Development Exam 1 1 Spring 2017 (Thursday, March 9) Name: CS 4330/5390: Mobile Application Development Exam 1 This test has 8 questions and pages numbered 1 through 7. Reminders This test is closed-notes and closed-book.

More information

UNDERSTANDING ACTIVITIES

UNDERSTANDING ACTIVITIES Activities Activity is a window that contains the user interface of your application. An Android activity is both a unit of user interaction - typically filling the whole screen of an Android mobile device

More information

MC Android Programming

MC Android Programming MC1921 - Android Programming Duration: 5 days Course Price: $3,395 Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse

More information

Multiple Activities. Many apps have multiple activities

Multiple Activities. Many apps have multiple activities Intents Lecture 7 Multiple Activities Many apps have multiple activities An activity A can launch another activity B in response to an event The activity A can pass data to B The second activity B can

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming Emmanuel Agu Editting in Android Studio Recall: Editting Android Can edit apps in: Text View: edit XML directly Design

More information

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Activity Basics Manifest File AndroidManifest.xml Central configuration of Android application Defines: Name of application Icon for

More information

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

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath 1 Framework Support (e.g. Android) 2 Framework Capabilities

More information

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

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ] s@lm@n Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ] Android AND-401 : Practice Test Question No : 1 Which of the following is required to allow the Android

More information

Upon completion of the second part of the lab the students will have:

Upon completion of the second part of the lab the students will have: ETSN05, Fall 2017, Version 2.0 Software Development of Large Systems Lab 2 1. INTRODUCTION The goal of lab 2 is to introduce students to the basics of Android development and help them to create a starting

More information

CS260 Intro to Java & Android 05.Android UI(Part I)

CS260 Intro to Java & Android 05.Android UI(Part I) CS260 Intro to Java & Android 05.Android UI(Part I) Winter 2015 Winter 2015 CS250 - Intro to Java & Android 1 User Interface UIs in Android are built using View and ViewGroup objects A View is the base

More information

android-espresso #androidespresso

android-espresso #androidespresso android-espresso #androidespresso Table of Contents About 1 Chapter 1: Getting started with android-espresso 2 Remarks 2 Examples 2 Espresso setup instructions 2 Checking an Options Menu items (using Spoon

More information

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015 Android System Architecture Android Application Fundamentals Applications in Android All source code, resources, and data are compiled into a single archive file. The file uses the.apk suffix and is used

More information

EMBEDDED SYSTEMS PROGRAMMING UI and Android

EMBEDDED SYSTEMS PROGRAMMING UI and Android EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI and Android STANDARD GESTURES (1/2) UI classes inheriting from View allow to set listeners that respond to basic gestures. Listeners are defined by suitable interfaces.

More information

CS260 Intro to Java & Android 05.Android UI(Part I)

CS260 Intro to Java & Android 05.Android UI(Part I) CS260 Intro to Java & Android 05.Android UI(Part I) Winter 2018 Winter 2018 CS250 - Intro to Java & Android 1 User Interface UIs in Android are built using View and ViewGroup objects A View is the base

More information

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android?

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android? Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android? A. Closing an app. B. Suspending an app C. Opening a new app D. Restoring the most recent

More information

Lecture 2 Android SDK

Lecture 2 Android SDK Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a

More information

Comparative Study on Layout and Drawable Resource Behavior in Android for Supporting Multi Screen

Comparative Study on Layout and Drawable Resource Behavior in Android for Supporting Multi Screen International Journal of Innovative Research in Computer Science & Technology (IJIRCST) ISSN: 2347-5552, Volume 2, Issue 3, May - 2014 Comparative Study on Layout and Drawable Resource Behavior in Android

More information