Introduction to Android Programming (CS5248 Fall 2015)



Similar documents
Android Environment SDK

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

Android Development. Marc Mc Loughlin

Getting Started with Android Development

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)

How To Develop Android On Your Computer Or Tablet Or Phone

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

An Introduction to Android

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

How To Run A Hello World On Android (Jdk) On A Microsoft Ds.Io (Windows) Or Android Or Android On A Pc Or Android 4 (

Jordan Jozwiak November 13, 2011

Android Environment SDK

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

Developing NFC Applications on the Android Platform. The Definitive Resource

Developing In Eclipse, with ADT

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

1. Introduction to Android

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

How to Create an Android Application using Eclipse on Windows 7

Programming with Android

Running a Program on an AVD

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

Eclipse installation, configuration and operation

Introduction to Android Development. Jeff Avery CS349, Mar 2013

IOIO for Android Beginners Guide Introduction

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

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

Introduction to Android

Here to take you beyond Mobile Application development using Android Course details

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

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

ITG Software Engineering

Fahim Uddin 1. Java SDK

Android Basics. Xin Yang

How To Develop An Android App On An Android Device

OpenCV on Android Platforms

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

Board also Supports MicroBridge

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

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

Android Programming: Installation, Setup, and Getting Started

Home Course Catalog Schedule Pricing & Savings Training Options Resources About Us

With a single download, the ADT Bundle includes everything you need to begin developing apps:

Introduction to Android

Installing the Android SDK

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

Android Geek Night. Application framework

Tutorial on Basic Android Setup

Hello World. by Elliot Khazon

Epidefender Studio Installation notice

Smartphone market share

Lab 0 (Setting up your Development Environment) Week 1

Android Application Development - Exam Sample

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

ECE 455/555 Embedded System Design. Android Programming. Wei Gao. Fall

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

Getting Started: Creating a Simple App

Practical Android Projects Lucas Jordan Pieter Greyling

Introduction to Android Development

Basic Android Setup Windows Version

Workshop on Android and Applications Development

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Setting up Sudoku example on Android Studio

Beginning Android Programming

Tutorial: BlackBerry Object API Application Development. Sybase Unwired Platform 2.2 SP04

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Android Tutorial. Larry Walters OOSE Fall 2011

Android Fundamentals 1

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

ADT Plugin for Eclipse

How to Install Applications (APK Files) on Your Android Phone

Lecture 1 Introduction to Android

Android Setup Phase 2

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

Building graphic-rich and better performing native applications. Pro. Android C++ with the NDK. Onur Cinar

TUTORIALS AND QUIZ ANDROID APPLICATION SANDEEP REDDY PAKKER. B. Tech in Aurora's Engineering College, 2013 A REPORT

Using Microsoft Visual Studio API Reference

Android Concepts and Programming TUTORIAL 1

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

CS378 -Mobile Computing. Android Overview and Android Development Environment

Homework 9 Android App for Weather Forecast

Mobile Application Development

Mobile Security - Tutorial 1. Beginning Advanced Android Development Brian Ricks Fall 2014

06 Team Project: Android Development Crash Course; Project Introduction

1) SETUP ANDROID STUDIO

Android Application Development

Getting started with Android and App Engine

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3

Login with Amazon Getting Started Guide for Android. Version 2.0

Hacking your Droid ADITYA GUPTA

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Open Source Telemedicine Android Client Development Introduction

Android Development Exercises Version Hands On Exercises for. Android Development. v

The power of root on Android emulators

Chapter 2 Getting Started

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

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Android Developer Fundamental 1

Transcription:

Introduction to Android Programming (CS5248 Fall 2015) Aditya Kulkarni (email.aditya.kulkarni@gmail.com) August 26, 2015 *Based on slides from Paresh Mayami (Google Inc.)

Contents Introduction Android OS Environment Setup

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging General Topics Android Application Components Misc: Media Recorder, MediaCodec, HTTP Post, MP4Parser

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging General Topics Android Application Components Misc: Media Recorder, MediaCodec, HTTP Post, MP4Parser Sample Application http://developer.android.com/guide/index.html

Application Fundamentals Android apps are written in Java

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system Android app lives in its own security sandbox System assigns each app a unique Linux user ID Each process has its own virtual machine Every application runs in its own Linux process

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system Android app lives in its own security sandbox System assigns each app a unique Linux user ID Each process has its own virtual machine Every application runs in its own Linux process The Android system implements the principle of least privilege http://developer.android.com/guide/components/fundamentals.html

Environment Setup Four basic steps to get an App running Step 1: Install JDK

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK Step 3: Create your first Android App

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK Step 3: Create your first Android App Step 4: Build and Run your App

Step-1: Install JDK

JDK Installation JDK and JRE are different! Can download the JDK for your OS at http://java.oracle.com Alternatively, for OS X, Linux: OS X: Open /Applications/Utilities/Terminal.app Type javac at command line Install Java when prompt appears Linux: Type sudo apt get install default jdk at command line (Debian, Ubuntu) Other distributions: consult the documentation

Install! 16

Step-2: Configure the SDK

SDK Configuration Download Android SDK from http://developer.android.com

SDK Configuration Download Android SDK from http://developer.android.com Or Simplest: Download and install Android Studio bundle (including Android SDK) for your OS

Install! 20

Step-3: Create your first Android App

Your first Android App

Long time ago, in a galaxy far, far away

Eclipse IDE- Official IDE for Android development ADT plugin Apache Ant for building projects

so Google said

Install

Run

Run Android SDK Manager Recommended: Install Android 2.2, 2.3.3 APIs and 4.x API Settings Do not worry about Intel x86 Atom, MIPS system images

Now you are ready for Android development!

Create new Android project

Create Activity

The Manifest File Identify any user permissions the application requires

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application Declare hardware and software features used or required by the application

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application Declare hardware and software features used or required by the application API libraries the application needs to be linked

The Manifest File

Step-4: Building & Running your App

Building Process Running

No Android Device?

No Android Device? Install USB Driver!!!

USB Driver Installation Install OEM USB Driver from ASUS website. http://support.asus.com/download/ and search by Transformer Update Driver Software from Device Manager Update Driver software Locate USB Driver folder Enable USB Debugging at Transformer

Enabling USB Debugging

Running Sample App

Running Sample App

Running Sample App

Sample Hello World Code

Editing Sample Code Add id to main.xml @+id/helloid

Editing Sample Code Add id to main.xml @+id/helloid Edit HelloWorldActivity.java

A Sample Code

A Sample Code 2 3 1 Important points 1. UI Element has an Id 2. Variables in our code link to UI elements 3. Update UI element content from the program

App Failure

Let us debug the code

Always, look at DDMS!!!

Correction

Debugging via Dalvik Debug Monitor Service (DDMS) Log.e("Hello, World", "Hello, BJ");

Android Application Components

Application Components Android Application.apk : Android package

Application Components Android Application.apk : Android package Four Application Components Activity Service Content Provider Broadcast Receiver

Application Components Android Application.apk : Android package Four Application Components Activity Service Content Provider Broadcast Receiver Communication among components except Content Provider Intent

Activity Activity Lifecycle Implement Lifecycle Callbacks

Activity Hierarchical View Architecture ViewGroup (Layout) View View ViewGroup (Layout) View View View ViewGroup

Activity Hierarchical View Architecture ViewGroup (Layout) View View ViewGroup (Layout) View View View ViewGroup Do not forget to declare Activity in the Manifest

Activity Start an Activity Start an Activity for a Result Caller Activity Callee Activity finish

Activities and Stack

Services A service is a component that runs in the background to perform long-running operations

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it e.g a service might play music in the background while the user is in a different app

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements Apps can also initiate broadcasts

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements Apps can also initiate broadcasts Although broadcast receivers don't display a UI, they may create a status bar notification to alert the user when a broadcast event occurs

Content Providers A content provider manages a shared set of app data

Content Providers A content provider manages a shared set of app data Through the content provider, other apps can query or even modify the data

Content Providers A content provider manages a shared set of app data Through the content provider, other apps can query or even modify the data Any app with the proper permissions can query part of the content provider

Intent An intent is an abstract description of an operation to be performed

Intent An intent is an abstract description of an operation to be performed It can be used with startactivity to launch an Activity

Intent An intent is an abstract description of an operation to be performed It can be used with startactivity to launch an Activity broadcastintent to send it to any interested BroadcastReceiver components

Intent An intent is an abstract description of an operation to be performed It can be used with startactivity to launch an Activity broadcastintent to send it to any interested BroadcastReceiver components startservice(intent) or bindservice(intent, ServiceConnection, int) to communicate with a background Service

UI Declaring Layout Initiated when called setcontentview() on oncreate()

UI Declaring Layout Initiated when called setcontentview() on oncreate() Use Visual Layout Editor for initial layout design

UI Declaring Layout Initiated when called setcontentview() on oncreate() Use Visual Layout Editor for initial layout design Edit XML file extensively

UI Handling UI Events onclick, onlongclick, onkey, ontouch,

Thread UI Thread Main thread per application is responsible for interacting with UI components

Thread UI Thread Main thread per application is responsible for interacting with UI components Application Not Responding problem If UI thread is blocked more than several seconds, ANR dialog appears Do not block the UI thread Do not access UI components outside UI thread

Thread UI Thread Main thread per application is responsible for interacting with UI components Application Not Responding problem If UI thread is blocked more than several seconds, ANR dialog appears Do not block the UI thread Do not access UI components outside UI thread modify

Use AsyncTask, Instead

Misc - Media Recorder Modify CameraPreview to see the video during recording

Misc Media Codec To access low-level media codecs, i.e. encoder/decoder components

Misc - HTTP Post Use HttpClient and HttpPost Use multi-part/form-data to encapsulate segment Do not excessively use memory

Misc Permission Issue Add following permissions to the Manifest file

Sample Implementation Option menu MainActivity Context menu Capture Play click CaptureActivity Capture Button Click Upload Service Background Upload PlayerActivity

Misc - Integration with MP4Parser Adding a jar file Create its jar file Add jar file to the app Build Path > Configure Build Path > Libraries > Add JARs If you include source files directly, Put Isoparser-default.properties to assets folder Change getresourceasstream( isoparserdefault.properties ) in PropertyBoxParserImpl to /assets/isoparser-default.properties https://github.com/sannies/mp4parser https://code.google.com/p/mp4parser/

Final Comment: Use ApiDemo!!!

General References How to work with Android GUI layouts https://www.youtube.com/watch?v=xn9kynwiobe Building and running your app http://developer.android.com/tools/building/building-eclipse.html Deployment of the.apk file http://stackoverflow.com/questions/3480201/how-do-you-installan-apk-file-in-the-android-emulator Find the hidden developer option http://www.cnet.com/howto/restore-the-developer-options-menu-in-android-4-2/ Rotation lock/unlock http://www.howtogeek.com/howto/26715/how-to-make-yourandroid-phone-stop-rotating-the-screen-whenyou%e2%80%99re-reading-sideways/ Video tutorials http://www.youtube.com/watch?v=5rhtkio_kdi Load/Open an existing package (e.g., the provided ClassExamples) into your eclipse File --> Import... --> General-Tab --> Existing Projects into Workspace (and click Next) Select root Directory: click Browse: select the folder the include the AndroidManifest.xml or project.properties files. Click finish

Thank You! Any questions