Develop a Hello World project in Android Studio Capture, process, store, and display an image. Other sensors on Android phones



Similar documents
1) SETUP ANDROID STUDIO

New Technology Introduction: Android Studio with PushBot

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

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

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)

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

Fahim Uddin 1. Java SDK

Tutorial on Basic Android Setup

Getting Started with Android Development

Basic Android Setup Windows Version

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

01. Introduction of Android

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

Tutorial on OpenCV for Android Setup

Example Connection between USB Host and Android

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

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

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

How to Create an Android Application using Eclipse on Windows 7

Introduction to Android Development

Android Environment SDK

Hello World. by Elliot Khazon

Cisco Cius Development Guide Version 1.0 September 30, 2010

Android Mobile App Building Tutorial

Android Basics. Xin Yang

How to build your first Android Application in Windows

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

Android Concepts and Programming TUTORIAL 1

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 (

OpenCV on Android Platforms

Setting up Sudoku example on Android Studio

How To Develop An Android App On An Android Device

Android Development. Marc Mc Loughlin

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

Getting Started with the ZED 2 Introduction... 2

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

Android Development Setup [Revision Date: 02/16/11]

Android: How To. Thanks. Aman Nijhawan

Board also Supports MicroBridge

Lab 0 (Setting up your Development Environment) Week 1

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

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

IOIO for Android Beginners Guide Introduction

Jordan Jozwiak November 13, 2011

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

About this Release. Introduction. Prerequisites. Installation. Using the Web SDK Packager

APPLICATION NOTE. Getting Started with pylon and OpenCV

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

Android Application Development

Android Setup Phase 2

Android Environment SDK

Appium mobile test automation

CS378 -Mobile Computing. Android Overview and Android Development Environment

Introduction to Android

Android and OpenCV Tutorial

Getting Started: Creating a Simple App

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

Tutorial on Basic Android Setup

Android Programming: Installation, Setup, and Getting Started

ID TECH UniMag Android SDK User Manual

Challenges in Android Application Development: A Case Study

Setting Up Your Android Development Environment. For Mac OS X (10.6.8) v1.0. By GoNorthWest. 3 April 2012

Introduction to Android

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

WEARIT DEVELOPER DOCUMENTATION 0.2 preliminary release July 20 th, 2013

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

As it relates to Android Studio. By Phil Malone:

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Running a Program on an AVD

Overview. About Interstitial Ads: About Banner Ads: About Offer-Wall Ads: ADAttract Account & ID

06 Team Project: Android Development Crash Course; Project Introduction

How to develop your own app

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

Practical Android Projects Lucas Jordan Pieter Greyling

IDE Integration for Android* Part of the Intel Integrated Native Developer Experience (Intel INDE) 1.5.7

Mobile Application Development Android

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

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

Introduction to Android Programming (CS5248 Fall 2015)

ANDROID INTRODUCTION TO ANDROID

Setting up Windows Phone 8 environment in VMWare

ORGANIZER QUICK REFERENCE GUIDE. Install GoToMeeting. Schedule a Meeting. Start a Scheduled Meeting. Start an Instant Meeting.

ANDROID DEVELOPER RESUME USA

Android Security Lab WS 2014/15 Lab 1: Android Application Programming

Parallels Desktop 4 for Windows and Linux Read Me

Application Development Setup Guide

Verizon Cloud Desktop Application Help Guide Version

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

1. Open the battery compartment as shown in the image.

Sage Grant Management System Requirements

COMBOGARDPRO. 39E Electronic Combination Lock SOFTWARE INSTALLATION INSTRUCTIONS

Read Me UNISTREAM AUTOMATION IDE

INTERNAL USE ONLY (Set it to white if you do not need it)

Mobile Application Development

Developing with Android Studio

Introduction to NaviGenie SDK Client API for Android

1. Introduction to Android

Transcription:

Kuo-Chin Lien

Develop a Hello World project in Android Studio Capture, process, store, and display an image on Android phones Other sensors on Android phones

If you have been using Eclipse with ADT, be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates. Where: http://developer.android.com/sdk/index.html System requirement (Windows): Microsoft Windows 8/7/Vista/2003 (32 or 64-bit) 2 GB RAM minimum, 4 GB RAM recommended 400 MB hard disk space + at least 1 GB for Android SDK, emulator system images, and caches 1280 x 800 minimum screen resolution Java Development Kit (JDK) 7 Optional for accelerated emulator: Intel processor with support for Intel VT-x, Intel EM64T (Intel 64), and Execute Disable (XD) Bit functionality

AVD manager - choose a device for emulation (Tools->Android->AVD Manager) Tip: What s theandroid version and API level of your phone? SDK manager download necessary packages (Tools->Android->SDK Manager)

.java Coding the behavior of your program.xml Settings (GUI/hardware arrangement) for the app.gradle Make file logcat In.java, use Log.d(TAG, debug_message); to print debug_message at logcat at run time

A snapshot of the IDE

.java: Coding the behavior of your program

.xml: GUI design Design mode and text mode

.gradle: Make file

Logcat: In.java, use Log.d(TAG, debug_message); to print debug_message at logcat at run time http://developer.android.com/tools/debugging/debugging-log.html

run Debug

In the debug mode, you can pause at the breakpoints in your program To advance to the first line inside a method call, click Step Into. To advance to the next line outside the current method, click Step Out. To continue running the app normally, click Resume Program.

2. Double click to edit the text More widgets 1. Go to the Design tab

1. Connect your Android phone to the computer 2. Turn on the phone, go to Developer Option, enable USB Debugging 3. Run your app as before

A button to bring the user to the preview mode which allows the user to take a picture. The program automatically converts the picture to grayscale Display the grayscale image Save the grayscale image

Download: http://opencv.org/ Import OpenCV as a library www.ece.ucsb.edu/~kuochin/290i/setupas.html Aside: $50,000 award for 11 CV challenges

Hardware permission GUI Image capture, processing, and display

Load OpenCV BaseLoaderCallback Will be called after OpenCV is loaded Set up a listener e here. e When the button is clicked, c call captureimage. captureimage Show the preview mode to the user Save an image Convert image to gray using OpenCV

Compose a camera intent Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); fileuri = getoutputmediafileuri(media_type_image); intent.putextra(mediastore.extra_output, fileuri); // set the image file name private static File getoutputmediafile(int type) { } Start the camera intent startactivityforresult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); ACTIVITY REQUEST CODE); // will enter the preview mode Receive the intent result void onactivityresult (int requestcode, int resultcode, Intent data){ // process the captured frame here } http://developer.android.com/guide/topics/media/camera.html#intents

OpenCV provides various functions to process an image: blur, edge detection, resize, morphological operations etc. We can call CvtColor( ) to transform an image from RGB to other color spaces: Imgproc.cvtColor(InputBuffer, OutputBuffer, Imgproc.COLOR_RGB2GRAY); See more detail here: http://docs.opencv.org/modules/imgproc/doc/mis / d /i /d / i cellaneous_transformations.html#cvtcolor See more functions here: http://docs.opencv.org/modules/imgproc/doc/im gproc.html

Sample code downloadable here: http://cs.ucsb.edu/~efujimoto/mobile/other/main b h Activity.java

Sample code for recording a video http://developer.android.com/training/camera/videobasics.html p Intent uses existing camera apps to help you capture images and videos, which is convenient but less flexible. To provide more compelling user experience (time lapse video, video snapshot ), you need to know the Camera class: http://developer.android.com/guide/topics/media/camera.html#customcamera http://developer.android.com/reference/android/hardware/camera.html For API >= 21, you can use Camera2 http://developer.android.com/reference/android/hardware/camera2/pack age-summary.html https://developer.android.com/samples/camera2basic/index.html OpenCV OpenCV tutorial: http://docs.opencv.org/doc/tutorials/tutorials.html OpenCV4Android: http://docs.opencv.org/platforms/android/refman.html

To accomplish the homework, you need the permissions to ACCESS_FINE_LOCATION and/or others ACCESS_COARSE_LOCATION INTERNET... See a list of the permissions i you can request: http://developer.android.com/reference/android/manifest.pe rmission.html

Location: A data class representing a geographic location. LocationManager: A class provides access to the system location services private LocationManager locationmanager; locationmanager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); provider = locationmanager.getbestprovider(criteria, false); Location location = locationmanager.getlastknownlocation(provider);... See the following links for details and more sample codes: http://developer.android.com/reference/android/location/locatio n.html http://developer.android.com/reference/android/location/locatio nmanager.html

private SensorManager sensormanager; private Sensor gyro; sensormanager = (SensorManager)getSystemService(SENSOR_SERVICE); gyro = sensormanager.getdefaultsensor(sensor.type_gyroscope); sensormanager.registerlistener(this, gyro, SensorManager.SENSOR_DELAY_NORMAL);... public void onsensorchanged(sensorevent event) { // read the sensor output and do something.. } See the following links for more sensors with sample codes http://developer.android.com/reference/android/hardware/senso rhtml r.html http://developer.android.com/reference/android/hardware/senso rmanager.html http://developer.android.com/reference/android/hardware/senso revent.html

Find this presentation at http://www.ece.ucsb.edu/~kuochin/290i/29 0I_Android_Tutorial.pdf Find sample codes at http://www.ece.ucsb.edu/ edu/~kuochin/290i/tut orialmaterial.zip