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



Similar documents
Running a Program on an AVD

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

Getting Started: Creating a Simple App

Android Development. Marc Mc Loughlin

Android Environment SDK

Android Basics. Xin Yang

Chapter 2 Getting Started

Lab 4 In class Hands-on Android Debugging Tutorial

ADT Plugin for Eclipse

Android Environment SDK

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

Developing Android Apps: Part 1

Developing In Eclipse, with ADT

1. Introduction to Android

Tutorial on Basic Android Setup

Getting Started with Android Development

As shown, the emulator instance connected to adb on port 5555 is the same as the instance whose console listens on port 5554.

IOIO for Android Beginners Guide Introduction

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

Android Setup Phase 2

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

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

Hello World. by Elliot Khazon

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

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)

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

Workshop on Android and Applications Development

Presenting Android Development in the CS Curriculum

How To Develop Android On Your Computer Or Tablet Or Phone

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Mobile Application Development 2014

Getting Started with Android

Introduction to Android

Android Application Development

Lab 0 (Setting up your Development Environment) Week 1

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

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

What else can you do with Android? Inside Android. Chris Simmonds. Embedded Linux Conference Europe Copyright 2010, 2net Limited.

Tutorial #1. Android Application Development Advanced Hello World App

Android For Java Developers. Marko Gargenta Marakana

Android Tutorial. Larry Walters OOSE Fall 2011

Mobile Application Development

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

Android Programming and Security

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

Android Programming: Installation, Setup, and Getting Started

An Introduction to Android

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

Android Programming Basics

How To Develop An Android App On An Android Device

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

Lecture 1 Introduction to Android

Developing NFC Applications on the Android Platform. The Definitive Resource

MMI 2: Mobile Human- Computer Interaction Android

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

How to develop your own app

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Introduction to Android Programming (CS5248 Fall 2015)

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

Frameworks & Android. Programmeertechnieken, Tim Cocx

CS378 -Mobile Computing. Android Overview and Android Development Environment

Android Framework. How to use and extend it

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

Introduction to Android SDK Jordi Linares

Introduction to Android. CSG250 Wireless Networks Fall, 2008

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Android Application Development - Exam Sample

Android Application Development Lecture Notes INDEX

Introduction to Android Development

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

Tutorial on Basic Android Setup

Mocean Android SDK Developer Guide

Introduction to NaviGenie SDK Client API for Android

Introduction to Android

TomTom PRO 82xx PRO.connect developer guide

Homework 9 Android App for Weather Forecast

Developing with Android Studio

Mobile Application Development Android

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Introduction (Apps and the Android platform)

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

How to build your first Android Application in Windows

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

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

COURSE CONTENT. GETTING STARTED Select Android Version Create RUN Configuration Create Your First Android Activity List of basic sample programs

Beginning Android Programming

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

Homeschool Programming, Inc.

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

OpenCV on Android Platforms

Android Geek Night. Application framework

AndroLIFT: A Tool for Android Application Life Cycles

Building Your First App

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

Transcription:

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Who am I? Lo Chi Wing, Peter Lecture 1: Introduction to Android Development Email: Peter@Peter-Lo.com Facebook: http://www.facebook.com/peterlo111 Peter Lo 2 Course Outline What Apps can you develop after this course? Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Introduction to Android Development Android Layout and Components Android Life Cycle and Permission Menu, Action Bar and Dialog Intent and Fragment List and Deployment 3 4

Are you take the Right Course? Where can you find the material? This course is intended for beginner who would like to learn how to develop Android Apps. The code examples are not particularly complex, but it is assumed that you have basic programming knowledge. Workshop Notes and Exercises http://www.peter-lo.com/teaching/4t025-1-a/ Android Developer Official Site http://developer.android.com/ Microsoft DreamSpark http://www.dreamspark.com 5 6 Mobile Phone Evolution What is Android? A Linux-based operating system for mobile devices. An open-source project and is distributed free of charge. Developed by the Open Handset Alliance and Google Inc. Supporting telephony, messaging, emailing, contact management, calendar, entertainment, multimedia experience, location services, mapping, social interaction, etc. 7 8

Android Family Platform Versions Android 1.5 (2009) Android 1.6 (2009) Android 2.0/2.1 (2009) Android 2.2 (2010) Android 2.3 (2010) Android 3.0 (2011) Android 4.0 (2012) Android 4.1 (2012) Android 4.4 (2013) 9 10 Source: http://developer.android.com/about/dashboards/index.html Screen Sizes and Densities Android Architecture 11 12 Source: http://developer.android.com/about/dashboards/index.html

Development Process for Android Apps Creating new Android Project Application Name name appears on device and title bar Minimum Required SDK minimum Android API level required for the app Project Name name for the Eclipse project Package Name Apps on a particular Android device must have unique packages Target SDK Android version that you want to use Theme specifies the Android UI style to apply for your app. Compile With the platform version against which you will compile your app. (By default, set to the latest version of Android available in your SDK). 13 14 Android Developer Tool (ADT) Structure of a Typical Android App File structure Palette, where we can choose different layouts and for the layout design Selector bar Zone where the current layout is rendered Tree View of the hierarchical structure of layouts and elements added to the screen. Object properties Source file with Activities, Services, Broadcast Receivers, and Content Providers Contain 2 auto generated files that should not be touched Provides access to resources (with unique ID) in App Contains text files, database, and the sort Contains file built by the ADT Switch from the graphical editor to the XML text editor 15 Executable generated from compiled classes Zipped archive file that will be shipped to android device Zipped application resources 16

Structure of a Typical Android App (cont.) The Manifest File API that allows you to use the newest API while remaining backward compatible drawable folders store image you need at different resolutions Before the Android system can start an application component, the system must know that the component exists by reading the application's AndroidManifest.xml file. The layout folder contains files that define the apps under interface RelativeLayout LinearLayout GridLayout FrameLayout AndroidManifest defines: App name App icon Activities used Permission required for App android.intent.action.main define the entry point for App Apps must declare all its components in this file, which must be at the root of the application project directory. 17 18 SDK Manager Simple Android App Program 19 package com.example.myfirstapp; import android.os.bundle; import android.app.activity; import android.view.menu; public class MainActivity extends Activity { @Override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } There is no need to type the import statements by hand. Just use the classes in your code, and when Eclipse marks the line as an error, click on the light bulb at the left, or hit [Ctrl] [1], then choose to have Eclipse insert the import statements for you. Apps are frequently shut down by the device. This lets you remember some info about the previous invocation. You should always call super.oncreate as first line of oncreate. Define the Activity for output Overriding an existing method @Override public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; } } Comment, all statement after // will not execute 20

Running Apps How to Testing or Running Apps? During the build process, your Android projects are compiled and packaged into an.apk file. It contains all of the information necessary to run your application on a device or emulator. If you are developing in Eclipse, the ADT plugin incrementally builds your project as you make changes to the source code. Eclipse outputs an.apk file automatically to the bin folder of the project, so you do not have to do anything extra to generate the.apk. On the Android Emulator: Deploy directly from Eclipse during development, do your normal testing here On an Android device: Deploy from your PC via USB Deploy from a Web site Deploy via email Deploy from the Android Market 21 22 Android Virtual Devices Operation of AVD AVD (Android Virtual Device) is an Android Emulator configuration that lets you model an actual device by defining hardware and software options 23 24

Debugging Log Cat The Android SDK provides most of the tools that you need to debug your applications. DDMS (Dalvik Debug Monitor Server) adb (Android Debug Bridge) JDWP debugger Breakpoint Log The Android logging system provides a mechanism for collecting and viewing system debug output. Logs from various applications and portions of the system are collected in a series of circular buffers, which then can be viewed and filtered by the logcat command. 25 26 Logcat Level Dalvik Debug Monitor Service (DDMS) Priority Meaning Description V Verbose Lowest priority. Used for low level debugging. Print stuff like position of your character when you are debugging why the hell it's going off screen etc. D Debug Messages that could be useful to determine where something went wrong. E.g. put a debug level message to each method beginning and end. I Info These messages can be useful in production as well. Log important events in info level, e.g. Engine created W Warning Something not quite right, but it's not a bug. E.g. you can't connect to Facebook to submit High score - not nice, but you can live with it. E Error Log exceptions and errors that you will need to analyze later and solve. F Fatal Fatal exception 4T025-1-A S Silent @ Peter Lo 2014 Highest priority, on which nothing is ever printed 27 DDMS (Dalvik Debug Monitor Service) is a tool that supports many things Simulate incoming calls in emulator Set GPS locations in emulator See print statements and runtime errors Set locations and take screenshots of actual Android device 28

Android Debug Bridge (adb) Break Point A versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device: Client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Server, which runs as a background process on your development machine. Daemon, which runs as a background process on each emulator or device instance. You can find the adb tool in <sdk>/platform-tools/. To create a break point, just double click the vertical bar in Java source code can When you run the application in debug mode, the emulator will pause and you will be able to examine your live code in this mode in the Eclipse debugger. 29 30