Introduction to Android Development. Daniel Rodrigues, Buuna 2014

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

Developing an Android App. CSC207 Fall 2014

Getting Started: Creating a Simple App

Presenting Android Development in the CS Curriculum

Android Development. Marc Mc Loughlin

Android Basics. Xin Yang

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

Tutorial #1. Android Application Development Advanced Hello World App

Developing Android Apps: Part 1

Android App Development. Rameel Sethi

MMI 2: Mobile Human- Computer Interaction Android

By sending messages into a queue, we can time these messages to exit the cue and call specific functions.

Android Quiz App Tutorial

Building Your First App

Boardies IT Solutions Tel:

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

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

Software Environments of Smartphone Applications

Introduction to Android Programming (CS5248 Fall 2015)

Android Development Introduction CS314

Mobile Application Development

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

Lecture 1 Introduction to Android

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Android Java Live and In Action

Mobile Application Development 2014

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

Frameworks & Android. Programmeertechnieken, Tim Cocx

Android Environment SDK

Android Application Development

Android. Learning Android Marko Gargenta. Tuesday, March 11, 14

Developing Android Applications: Case Study of Course Design

Creating a List UI with Android. Michele Schimd

Getting started with Android and App Engine

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Jordan Jozwiak November 13, 2011

Mobile Application Frameworks and Services

Chapter 2 Getting Started

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

Tutorial: Setup for Android Development

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

Android Environment SDK

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

Hello World. by Elliot Khazon

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

Introduction to Android SDK Jordi Linares

Android For Java Developers. Marko Gargenta Marakana

Login with Amazon Getting Started Guide for Android. Version 2.0

ADT Plugin for Eclipse

Getting Started With Android

Android Concepts and Programming TUTORIAL 1

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

Mocean Android SDK Developer Guide

Android Programming Basics

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

Basics of Android Development 1

Android App Development Lloyd Hasson 2015 CONTENTS. Web-Based Method: Codenvy. Sponsored by. Android App. Development

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

Developing NFC Applications on the Android Platform. The Definitive Resource

How to develop your own app

Developing Android Applications Introduction to Software Engineering Fall Updated 7 October 2015

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

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

Android Developer Fundamental 1

MAP524/DPS924 MOBILE APP DEVELOPMENT (ANDROID) MIDTERM TEST OCTOBER 2013 STUDENT NAME STUDENT NUMBER

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

IOIO for Android Beginners Guide Introduction

OpenCV on Android Platforms

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

Android Development Tools for Eclipse

How to Create an Android Application using Eclipse on Windows 7

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Hello World! Some code

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Mobile Application Development Android

Beginning Android Programming

Getting Started with Android Development

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

Learning Material Design

How To Develop Android On Your Computer Or Tablet Or Phone

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

HERE SDK for Android. Developer's Guide. Online Version 2.1

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

CS 528 Mobile and Ubiquitous Computing Lecture 2: Android Introduction and Setup. Emmanuel Agu

ELET4133: Embedded Systems. Topic 15 Sensors

5 reasons to choose Streamezzo SDK over Android SDK Page 2

Android Application Development. Yevheniy Dzezhyts

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

Tutorial on Basic Android Setup

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

A software stack for mobile devices:

Lab 0 (Setting up your Development Environment) Week 1

Introduction to NaviGenie SDK Client API for Android

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

Android Studio Application Development

Android Application Development - Exam Sample

Android Development Tutorial

Android Application Development Lecture Notes INDEX

Creating a 2D Game Engine for Android OS. Introduction

Transcription:

Introduction to Android Development Daniel Rodrigues, Buuna 2014

Contents 1. Android OS 2. Development Tools 3. Development Overview 4. A Simple Activity with Layout 5. Some Pitfalls to Avoid 6. Useful Apps and Libraries 7. About Buuna 4/7/14 Buuna 2014 2

Aim of Presentation! Provide a high level overview on how both Android apps operate and how they are developed. Required tools and their purpose. Design and development considerations to keep in mind.! Provide a starting point for experimenting and research with Android development. Aspects of Android development that aren't likely to be encountered early on will not be covered in detail. Technical specifics will also not be covered in depth either but followup research is encouraged. 4/7/14 Buuna 2014 3

Android OS 4/7/14 Buuna 2014 4

OS Internals! Android is Linux-based although apps are usually developed against APIs that abstract anything Linux-specific. The OS mainly provides a platform to run instances of the DVM (Dalvik Virtual Machine). Each Android app runs as its own user, in its own process, in its own DVM instance. In Android 4.4, Google introduced ART (Android Run Time) which will potentially replace Dalvik in the long term.! For a typical app developer, being Linux-based is mostly an implementation detail. 4/7/14 Buuna 2014 5

Developer s Perspective! Android apps are developed in Java using the Android API. It s possible to develop natively in C/C++ with some caveats but it s generally not recommended.! Dalvik's class libraries will be mostly familiar to Java SE developers but there are some differences.! Android's class library is based on Apache Harmony 6 which is mostly compatible with Java SE 6. 4/7/14 Buuna 2014 6

Development Tools 4/7/14 Buuna 2014 7

Which IDE?! Eclipse + ADT (Android Developer Tools) was the primary IDE for Android development.! Android Studio is a new IDE that is being actively developed and is available for download now. Still an early access preview but it addresses many stability and usability issues of Eclipse. v0.4.6 is available for download from Google and newer (albeit potentially less stable) versions are available from the Canary channel. New versions are released rapidly if you prefer to be on the bleeding edge or have issues with your current version. 4/7/14 Buuna 2014 8

Android SDK Manager! Used to install or update the Android API SDKs, libraries and the Android build tools used within the IDE itself.! You'll use it mainly to install files needed to develop and test for a given Android API. Not all of them are bundled in Android Studio! 4/7/14 Buuna 2014 9

AVDM & Emulator! Android Virtual Device Manager Used to manage a list of your virtual Android devices for use with the Android Emulator.! Define screen dimensions, Android API version, memory size and other hardware specifics.! Test your Android app without requiring a matching phone with matching API version. 4/7/14 Buuna 2014 10

Layout Editor! WYSIWYG editor used for editing views and their properties for a given layout.! Layouts, like most other Android resources, are serialised to XML files. They can be edited directly if you prefer; it's up to your personal preference. Both methods provide an up-to-date visual preview. 4/7/14 Buuna 2014 11

Layout Editor (continued)! Allows you to preview layouts with a given screen size, API version and theme. Observe what happens when your layout is previewed in landscape, on a smaller screen, with a different aspect ratio etc.! Try to do as much as possible in the layout editor and keep programmatic layout code to a minimum. 4/7/14 Buuna 2014 12

Development Overview 4/7/14 Buuna 2014 13

The Activity Class! An Activity usually manages a single screen's behaviour.! Activity instances initialise themselves in the oncreate() method. Main initialisation task is to call setcontentview() to initialise the UI with a given layout.! Contains methods to handle user interaction with the layout. 4/7/14 Buuna 2014 14

The Activity Class (continued)! Various lifecycle callback methods are called when the activity s state changes (onstart(), onpause() etc.). Only one activity is active at a time; navigating to a new activity suspends the current one. You may have a design that calls for modular sub-activities that can be added to a single parent activity; investigate Fragments to learn more.! Check out the sample Hello World Activity and layout XML included in newly created projects. 4/7/14 Buuna 2014 15

Layout Fundamentals! Layout creation mainly involves organising Views into the appropriate ViewGroups. Individual Android UI widgets are often implemented as a single View.! A collection of these widgets (Views) can be stored within a container layout (a ViewGroup) to structure them. 4/7/14 Buuna 2014 16

Device Variance! Visual resources must account for major variations in both screen size and screen density.! DP (Density-independent Pixels) are used for layout measurement to account for the density disparity.! Android can automatically select resources based on the running device metrics. Example: Higher resolution bitmap resources on devices with greater DPI. The closest matching resource is picked in the absence of an exact match. 4/7/14 Buuna 2014 17

Device Variance (continued)! Resource folders have qualifiers in their names based on their intended device class. Folder selection is dependent on the running device. Example: /drawable-mdpi, /drawable-hdpi Note the ic-launcher.png icon file in newly created Android project.! You can design for a single device for simplicity. Since Android picks the resource with the closest match, it's possible to supply only a single set of resources that will be used on all devices. 4/7/14 Buuna 2014 18

AndroidManifest.xml! Exposes some key characteristics about your app to the system. Minimum API version required for your app to function. Declaration of permissions required by your app such as internet access, ability to write files to storage etc. Declaration of activities in your app including which one will be the initial activity of your app. App name, icon to display, versioning info... 4/7/14 Buuna 2014 19

A Simple Activity with Layout 4/7/14 Buuna 2014 20

MainAc'vity.java ac'vity_main.xml public class MainActivity extends Activity { } private static final String TAG = "MainActivity"; //oncreate() can be considered the entry point to our app //note it will be called again if the activity is destroyed @Override protected void oncreate(bundle savedinstancestate) { } super.oncreate(savedinstancestate); //R.layout.activity_main refers to /res/layout/activity_main.xml" setcontentview(r.layout.activity_main); //R.id.demoButton refers to the "@+id/demobutton in activity_main.xml Button button = (Button)findViewById(R.id.demoButton); button.setonclicklistener(new View.OnClickListener() { }); @Override public void onclick(view view) { } Log.i(TAG, "button tapped!"); presentdialog(); private void presentdialog() { } new AlertDialog.Builder(this).setTitle("Example title") //R.drawable.ic_launcher refers to /res/drawable- */ic_launcher.png.seticon(r.drawable.ic_launcher).setmessage("example message body").setpositivebutton("yes", new DialogInterface.OnClickListener() { }) @Override public void onclick(dialoginterface dialoginterface, int i) { } Log.i(TAG, "You clicked Yes!");.setNegativeButton("No", new DialogInterface.OnClickListener() { }) @Override public void onclick(dialoginterface dialoginterface, int i) { }.show(); Log.i(TAG, "You clicked No!"); <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="com.uts.emptyprojectnew.app.mainactivity"> <TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:id="@+id/hellotext" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/present_dialog" android:id="@+id/demobutton" android:layout_below="@+id/hellotext" android:layout_centerhorizontal="true" android:layout_margintop="20dp" android:textcolor="@android:color/black" /> </RelativeLayout> 4/7/14 Buuna 2014 21

How it Looks 4/7/14 Buuna 2014 22

How it Looks in Android Studio 4/7/14 Buuna 2014 23

Some Pitfalls to Avoid! 4/7/14 Buuna 2014 24

Android Design vs. ios Design! If you're mostly familiar with ios UI design, don't assume that Android apps should be designed the same way. Forcing an ios-style UI into an Android app is very painful and you end up fighting the framework to do so; it's not worth it. Google provides detailed design guidelines to use as a reference. 4/7/14 Buuna 2014 25

API revisions! Ensure the API version you re targeting contains the functionality your app depends on. Check the docs for when a given class or method was introduced.! The Android API has changed substantially in a relatively short time. Large amount of seemingly useful functionality has been deprecated. Refer to the documentation and up-to-date discussions when considering using an unfamiliar class. 4/7/14 Buuna 2014 26

Stuck in the Layout Editor?! If so, stop and consider if an alternate ViewGroup and View hierarchy may work out.! Each ViewGroup has major differences in how its child Views are structured. Can be initially daunting at first once you start nesting them. Experimenting with a clean slate in the Layout Editor can be extremely helpful when starting out. 4/7/14 Buuna 2014 27

Useful Apps & Libraries 4/7/14 Buuna 2014 28

Open Source! Retrofit is a simple HTTP REST client with minimal development overhead. Other libraries from square.github.io are also worth checking out (butterknife, picasso ).! jfeinstein10/slidingmenu on GitHub provides an easy to use implementation of the typical sliding menu UI component.! http://wwww.androidviews.net is a large repository of custom Android views. Before attempting to roll your own, check to see if someone has already shared their implementation of it! 4/7/14 Buuna 2014 29

An Alternative Emulator! The bundled Android Emulator can be quite slow even when configured for speed.! Genymotion is substantially faster and free for personal use.! Also includes convenient interfaces for updating the sensor state of the emulated device sensors (GPS, battery life ).! Integrates into developer workflow just as well as the default emulator. 4/7/14 Buuna 2014 30

About Buuna 4/7/14 Buuna 2014 31

About Buuna! Proudly 100% Australian owned and operated! Specializes in the complete and overall mobile device solution - strategy, design, development and marketing! Mobile and touch experts that understands the interaction principles behind touch devices and software! All work done locally in-house in our Sydney CBD studio. No outsourcing of any kind.! Strong emphasis on quality engineering with highly technical, computer-science theory orientated approach for smooth, stable and secure software! Proven experience and great ongoing relationships with corporate, enterprise and agency clients and projects, such as Toyota, Skoda, Ricoh, Wunderman and Hothouse! Featured on Sky News, AdNews, B&T, Dell Tech One and Aspire Magazine 4/7/14 Buuna 2014 32

For more information! Check us out on www.buuna.com/blog/ and like us on Facebook https://www.facebook.com/buunadev for more interesting articles on Android and ios development! 4/9/14 Buuna 2014 33