CS 4518 Mobile and Ubiquitous Computing Lecture 7: Fragments, Camera Emmanuel Agu

Similar documents
Onboard Android Sensor Access

Third Generation For Android

Davis Art Images: Create and Share Slideshows

ANDROID DIALOGS (Chapter 12)

FLIR Tools Mobile for Android

Autodesk 123-D Catch ipad App

Wordpress Wizard... 3 Section 1 Wordpress Getting Your Domain... 4 Get Your Hosting Plan... 5 Updating Your Name Servers in NameCheap...

Custom Mobile App Support

Pair My Cricut Explore or Cricut Maker machine via Bluetooth?

SIM1 Guitar. Android/iOS App for XT-1 User Manual EN

DEVELOPING FOR GOOGLE GLASS

Experiment Assistant Instruction Manual. Nano3D Biosciences, Inc.

USER GUIDE Third Generation For Android and ios

Using the VitalSource ebook App

Live Agent for Administrators

Blue-Bot TEACHER GUIDE

User Guidelines for Downloading Calibre Books on Android with Talkback Enabled

BBM for BlackBerry 10. User Guide

Concept Connect. ECE1778: Final Report. Apper: Hyunmin Cheong. Programmers: GuanLong Li Sina Rasouli. Due Date: April 12 th 2013

1 Overview Introduction Acronyms & abbreviations...2

Live Agent for Administrators

Savant Lighting TrueImage App Setup Guide

Enhanced Push-to-Talk Application for iphone

CHATS Meals On Wheels Online Ordering User Guide

Scanning Options. Plain Paper Printing

Live Agent for Administrators

User Manual. This User Manual will guide you through the steps to set up your Spike and take measurements.

User Guide. PTT Radio Application. ios. Release 8.3

Enhanced Push-to-Talk Application for Android

User Guide. PTT Radio Application. Android. Release 8.3

iphoto Getting Started Get to know iphoto and learn how to import and organize your photos, and create a photo slideshow and book.

Share your Live Photos with friends and family by printing, ordering prints from Snapfish (US only), and via Facebook or .

Kodiak Corporate Administration Tool

SafetyNet Mobile v3.0

User Guide: PTT Radio Application - ios. User Guide. PTT Radio Application. ios. Release 8.3

Location Based Services

No more boredom! RULEBOOK

Banner. Double Banner

Add items to an existing album. While viewing photo thumbnails, tap Select, select items, tap Add To, then select the album.

Guide to OverDrive for Students

PDF / HOW TO TURN ON THE PS4 EBOOK

Celtx Studios Owner's Manual January 2011

I am going to try to send a theological book to your mobile phones through Bluetooth. Before I do that I want to tell you a little about this book.

EXILIM ALBUM 1.1. Introduction

CS371m - Mobile Computing. Sensing and Sensors

Consultation PTM (Parent s Guide) Consultation Mobile Apps (Parent s guide) Empower People. One Solution

Bridgemate App. Information for bridge clubs and tournament directors. Version 2. Bridge Systems BV

ON1 Photo RAW User Guide

Jing PDF Tutorial Template

Live Agent for Support Supervisors

Location Location support classes Maps Map support classes

CamFi TM. CamFi User Guide. CamFi Remote Camera Controller. CamFi Limited Copyright 2015 CamFi. All Rights Reserved.

Guiding Visually Impaired People with NXT Robot through an Android Mobile Application

Falsework & Formwork Visualisation Software

Mine Seeker. Software Requirements Document CMPT 276 Assignment 3 May Team I-M-Assignment by Dr. B. Fraser, Bill Nobody, Patty Noone.

Browser Streaming and Mobile-App Instructions for ios and Android tm

Creating a Mobile Game

The mobile device should be open to something neutral, like the device s Home screen

IE11, Edge (current version), Chrome (current version), Firefox (current version)

User s Guide. 1. Project Screen 2. Camera Screen 3. Photo Details Screen

INTRODUCTION. Welcome to Subtext the first community in the pages of your books.

Amazon Money Maker... 2 Section 1 - Amazon Heat Seeker... 3 Star Rating... 3 Reviews... 3 Cost... 3 Finding Products... 4 Keyword Research...

Case Air Wireless TETHERING AND CAMERA CONTROL SYSTEM

FamilySearch Mobile Apps: Family History Anytime, Anywhere

Free Tech Tools That Increase Productivity

Case Air Wireless TETHERING AND CAMERA CONTROL SYSTEM

TRBOnet Mobile. User Guide. for Android. Version 2.0. Internet. US Office Neocom Software Jog Road, Suite 202 Delray Beach, FL 33446, USA

Augmented Reality on Android

Install the App. Search the App/Play Store for SiOnyx Aurora. Tap Get/Install. (Screens will differ slightly between ios and Android devices.

Share My Design Space Project to Facebook or Pinterest?

Enhanced Push-to-Talk Application for iphone

Lazy Money Method. With Methods Like These, Why are You Broke?

Project Marvin: A Social Networking Program for Android

Note: Adjustment layers are available only in Photo Explosion Deluxe.

Case Air Wireless TETHERING AND CAMERA CONTROL SYSTEM

Start or stop video recording. Camera/ Video switch

Apocalypse Defense. Project 3. Blair Gemmer. CSCI 576 Human-Computer Interaction, Spring 2012

SINGING WINE GLASSES AARTI PARUPUDI. B. Tech., Jawaharlal Nehru Technological University, 2010 A REPORT

Making Domino Designer work like you want

Product Requirements Document

Follow the rule book for Game Changes, Only Don Lewis the Ref Assigner should edit a game. Do Not Edit Games Game Dates and Times

TRBOnet Mobile. User Guide. for ios. Version 1.8. Internet. US Office Neocom Software Jog Road, Suite 202 Delray Beach, FL 33446, USA

Google Earth 101. A lesson about the basics of the Google Earth program, and how to use it with the REAL storm surge visualization tool.

METRO TILES (SHAREPOINT ADD-IN)

User Guide: PTT Application - Android. User Guide. PTT Application. Android. Release 8.3

The Beginner's Guide To Android Game Development Free Download PDF

uiulearn TUTORIAL INTEGRATIONS> HOW TO USE PANOPTO (STUDENT)

All files must be in the srgb colour space This will be the default for most programs. Elements, Photoshop & Lightroom info slides 71-73

Bridgemate App. Tournament directors features. Bridge Systems BV

Live Agent for Support Supervisors

FAST TRACK READ ME FIRST! FAST TRACK E300 A Quick-Start Guide to Installing and Using Your COOLPIX 300. Contents. Nikon View... 25

Passport Companion iphone App. How to Add a Your Visit and Your Photos to a Park

TABLE OF CONTENTS. Logging into the Website Homepage and Tab Navigation Setting up Users on the Website Help and Support...

Messaging is the new social media

GRAPHOGAME User Guide:

Comparison ibeacon VS Smart Antenna

USER GUIDE THIS USER GUIDE WILL TAKE YOU THROUGH ALL THE DIFFERENT INSTALLATION STEPS OF PHANTOM. YOU CAN ALSO ACCESS OUR VIDEO TUTORIALS HERE

Can I Change My Wordpress Theme Without Losing Content

eventzee Scavenger Hunt Guide

USER GUIDE CUBEACON TOOLS MOBILE ANDROID APP

Transcription:

CS 4518 Mobile and Ubiquitous Computing Lecture 7: Fragments, Camera Emmanuel Agu

Fragments

Recall: Fragments Sub-components of an Activity (screen) An activity can contain multiple fragments, organized differently on different devices (e.g. phone vs tablet) Fragments need to be attached to Activities.

Fragments Ref: Android Nerd Ranch (2 nd ed), Ch 7, pg 121 To illustrate fragments, we create new app CriminalIntent Used to record office crimes e.g. leaving plates in sink, etc Record includes: Title, date, photo List-detail app + Fragments On tablet: show list + detail On phone: swipe to show next crime

Fragments Activities can contain multiple fragments Fragment s views are inflated from a layout file Can rearrange fragments as desired on an activity i.e. different arrangement on phone vs tablet

Starting Criminal Intent Initially, develop detail view of CriminalIntent using Fragments Final Look of CriminalIntent Start small Develop detail view using Fragments

Starting Criminal Intent Crime: holds record of 1 office crime. Has Title e.g. Someone stole my yogurt! ID: unique identifier of crime CrimeFragment: UI fragment to display Crime Details CrimeActivity: Activity that contains CrimeFragment Next: Create CrimeActivity

Create CrimeActivity in Android Studio Creates CrimeActivity.java Formatted using activity_crime.xml

Fragment Hosted by an Activity Each fragment must be hosted by an Activity To host a UI fragment, an activity must Define a spot in its layout for the fragment Manage the lifecycle of the fragment instance (next) E.g.: CrimeActivity defines spot for CrimeFragment

Fragment s Life Cycle Fragment s lifecycle similar to activity lifecycle Has states running, paused and stopped Also has some similar activity lifecycle methods (e.g. onpause(), onstop( ), etc) Key difference: Android OS calls Activity s oncreate, onpause( ), etc Fragment s oncreateview( ), onpause( ), etc called by hosting activity NOT Android OS! E.g. Fragment has oncreateview

Hosting UI Fragment in an Activity 2 options. Can add fragment to either Activity s XML file (layout fragment), or Activity s.java file (more complex but more flexible) We will add fragment to activity s.java file now First, create a spot for the fragment s view in CrimeActivity s layout

Creating a UI Fragment Creating Fragment is similar to creating activity 1. Define widgets in a layout (XML) file 2. Create java class and specify layout file as XML file above 3. Get references of inflated widgets in java file (findviewbyid), etc XML layout file for CrimeFragment (fragment_crime.xml)

Java File for CrimeFragment In CrimeFragment Override CrimeFragment s oncreate( ) function Format Fragment using fragment_crime.xml Note: Fragment s view inflated in Fragment.onCreateView(), NOT oncreate

Wiring up the EditText Widget Add listener to listen for text change events Get handle to EditText widget Store user s input as Crime Title (if text entered)

Adding UI Fragment to FragmentManager We add new fragment to activity using FragmentManager FragmentManager Manages fragments Adds fragment s views to activity s view Handles List of fragment Back stack of fragment transactions Find Fragment using its ID Interactions with FragmentManager are done using transactions Add Fragment to activity s view

Examining Fragment s Lifecycle FragmentManager calls fragment lifecycle methods onattach( ), oncreate( ) and oncreateview() called when a fragment is added to FragmentManager onactivitycreated( ) called after hosting activity s oncreate( ) method is executed If fragment is added to already running Activity then onattach( ), oncreate( ), oncreateview(), onactivitycreated( ), onstart( ) and then onresume( ) called

The Mobile Camera Interesting application

Mobile App: Word Lens Translates signs in foreign Language Google bought company. Now integrated into Google Translate [ Video ]

Camera:Taking Pictures

Taking Pictures with Camera Ref: https://developer.android.com/training/camera/photobasics.html How to take photos from your app using existing Android Camera app Steps: 1. Request Camera Permission 2. Take a Photo with the Camera App 3. Get the Thumbnail 4. Save the Full-size Photo

Request Permission to Use SmartPhone Camera If your app takes pictures using Android Camera, on Google Play, can make your app visible only to devices with a camera E.g. This app requires a smartphone camera Make the following declaration in AndroidManifest.xml

Take a Photo with the Camera App To take picture, your app needs to send Intent to Android s Camera app, (i.e. action is capture an image) Potentially, multiple apps/activities can handle take a picture Check that at least 1 Activity that can handle request to take picture using resolveactivity Call startactivityforresult( ) with Camera intent since picture sent back Build Intent describing taking a picture Send Intent requesting taking a picture (usually handled by Android s Camera app) Check that there s at least 1 Activity that can handle request to take picture

Get the Thumbnail Android Camera app returns thumbnail of photo (small bitmap) Thumbnail returned in extra of Intent delivered to onactivityresult( ) startactivityforresult Your App Android Camera app onactivityresult

Save Full-Sized Photo Ref: https://developer.android.com/training/basics/data-storage/files.html Android Camera app can save full-size photo to 1. Public external storage (shared by all apps) getexternalstoragepublicdirectory( ) Need to get permission 2. Private storage (Seen by only your app, deleted when your app uninstalls): getexternalfilesdir( ) Either way, need phone owner s permission to write to external storage In AndroidManifest.xml, make the following declaration

Taking Pictures: Bigger Example

Taking Pictures with Intents Ref: Ch 16 Android Nerd Ranch 2 nd edition Would like to take picture of Crime to document it Use implicit intent to start Camera app from our CrimeIntent app Recall: Implicit intent used to call component in different activity Click here to take picture Launches Camera app

Create Placeholder for Picture Modify layout to include ImageView for picture Button to take picture

Create Layout for Thumbnail and Button First, build out left side

Create Camera and Title Build out right side

Include Camera and Title in Layout Include in previously created top part Create, add in bottom part Camera and Title The rest of the layout

Get Handle of Camera Button and ImageView To respond to Camera Button click, in camera fragment, need handles to Camera button ImageView

Firing Camera Intent Create new intent for image capture Check with PackageManager that a Camera exists on this phone Build Intent to capture image, store at uri location Take picture when button is clicked

Declaring Features Declaring uses-features in Android manifest means only cameras with that feature will see this app for download on the app store E.g. declaring uses-feature android.hardware.camera, only phones with cameras will see this for download

References Google Camera Taking Photos Simply Tutorials, http://developer.android.com/training/camera/phot obasics.html Busy Coder s guide to Android version 4.4 CS 65/165 slides, Dartmouth College, Spring 2014 CS 371M slides, U of Texas Austin, Spring 2014