Commons Attribution 3.0 Unported License Android .

3y ago
43 Views
5 Downloads
1.57 MB
60 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Bria Koontz
Transcription

This work is licensed under a CreativeCommons Attribution 3.0 Unported LicenseAndroid ApplicationProgramming WorkshopDr. Frank McCownComputer Science Dept.Harding UniversitySearcy, Arkansas, USAMarch 9, 2011

Workshop shop.html2

Setup Development Environment Install JDK 6 Install Eclipse IDE for Java EE Developers (version 3.5 or3.6) Download and unpack the Android SDK Install Android Development Tools (ADT) plugin forEclipse Using the Android SDK and AVD Manager, add the SDKPlatform Android 2.2, API 8 package Detailed install instructions available on Android ml3

4

Agenda Introduction to AndroidAndroid emulator basicsMobile devices and applicationsSimple Android app10 minute break Android activities and intentsTic-tac-toe exampleUser interface issuesWrap-up5

Why Mobile App Development? Mobile platform is the platform of the future– Double-digit growth in world-wide smartphoneownership3 Job market is hot– Market for mobile software surges from 4.1 billion in2009 to 17.5 billion by 20121– 2010 Dice.com survey: 72% of recruiters looking foriPhone app developers, 60% for Android1– Dice.com: mobile app developers made 85,000 in2010 and salaries expected to rise2 Students are naturally /content/oct2010/tc20101020 gencies3http://www.gartner.com/it/page.jsp?id 146631326

droid-vs-blackberry.html7

Why Android? A lot of students have them– 2010 survey by Univ of CO1: 22% of collegestudents have Android phone (26% Blackberry,40% iPhone)– Gartner survey2: Android used on 22.7% ofsmartphones sold world-wide in 2010 (37.6%Symbian, 15.7% iOS) Students already know Java and Eclipse– Low learning curve– CS0 students can use App Inventor for w.gartner.com/it/page.jsp?id 1543014

Why Android? Transferring app to phone is trivial– Can distribute by putting it on the web– Android Market for wider distribution It’s not 1984Image: http://www.youtube.com/watch?v Pm8iTUI-MvU9

Types ofAndroid Devices10

HTC Droid IncredibleMotorola id-iphone-3gs.html11

Galaxy Tablet Retail: 250 with 2 yearcontract 7-inch 1024 x 600-pixel LCDscreen 0.84 pounds 7.48 x 4.74 x 0.47 inches 1 GHz Coretx A8 processor 512 MB RAM 16 or 32 GB internalstorage Front and rear /SCH-I800BKAVZW12

Android-Powered MicrowaveBy Touch Revolution – at CES powered-microwave-cooking-google13

Google Nexus One Retail: 530 Not tied to single provider 3.7-inch 800 x 400-pixelOLED screen No support for multitouch 512 MB of built-in flashmemory Preloaded 4 GB SD card Ubiquitous voicerecognition 5-megapixel camera withzoom and flash Navigation system usingGoogle Maps and GPShttp://www.wired.com/reviews/product/pr nexus one14

Brief History 2005– Google acquires startup Android Inc. to start Android platform– Work on Dalvik VM begins 2007– Open Handset Alliance announced– Early look at SDK 2008–––––Google sponsors 1st Android Developer ChallengeT-Mobile G1 announcedSDK 1.0 releasedAndroid released open source (Apache License)Android Dev Phone 1 releasedPro Android by Hashimi & Komatineni (2009)15

Brief History cont. 2009– SDK 1.5 (Cupcake) New soft keyboard with “autocomplete” feature– SDK 1.6 (Donut) Support Wide VGA– SDK 2.0/2.0.1/2.1 (Eclair) Revamped UI, browser 2010– Nexus One released to the public– SDK 2.2 (Froyo) Flash support, tethering– SDK 2.3 (Gingerbread) UI update, system-wide copy-paste16

Brief History cont. 2011– SDK 3.0 (Honeycomb) for tablets only New UI for tablets, support multi-core processors17

What is Google Android? A software stack for mobile devices that includes– An operating system– Middleware– Key Applications Uses Linux to provide core system services–––––SecurityMemory managementProcess managementPower managementHardware drivers18

android.html19

Android Emulator or AVD Emulator is essential to testing app but is nota substitute for a real device Emulators are called Android Virtual Devices(AVDs) Android SDK and AVD Manager allows you tocreate AVDs that target any Android API level AVD have configurable resolutions, RAM, SDcards, skins, and other hardware20

Android Emulator: 1.6 Device21

Android Emulator: 2.2 Device22

Android Emulator: 3.0 Device23

Emulator Basics Host computer’s keyboard worksHost’s mouse works like fingerUses host’s Internet connectionSide buttons work: Home, Menu, Back,Search, volume up and down, etc. Ctrl-F11 toggle landscape portrait Alt-Enter toggle full-screen mode More info vices/emulator.html24

Emulator Limitations No support for placing or receiving actual phone calls– Simulate phone calls (placed and received) through the emulatorconsole No support for USB connectionsNo support for camera/video capture (input)No support for device-attached headphonesNo support for determining connected stateNo support for determining battery charge level and AC chargingstate No support for determining SD card insert/eject No support for Bluetooth No support for simulating the accelerometer– Use OpenIntents’s Sensor Simulator25

In other words,test your app onan actual device!26

Create an AVD usingAndroid SDK and AVD Manager27

Or From the Command LineC:\android-sdk-windows\tools android create avd -n MyDevice -t android-8Android 2.2 is a basic Android platform.Do you wish to create a custom hardware profile [no]Device nameCreated AVD 'MyDevice2' based on Android 2.2,with the following hardware config:Target platformhw.lcd.density 240vm.heapSize 24C:\android-sdk-windows\tools emulator -avd MyDeviceLaunch deviceMore /devices/managing-avds-cmdline.html28

Play Time:Get to know yourEmulator29

Mobile Devices: Advantages Always with the userTypically have Internet accessTypically GPS enabledTypically have accelerometer & compassMany have cameras & microphonesMany apps are free or low-cost30

Mobile Devices: Disadvantages Limited screen sizeLimited battery lifeLimited processor speedLimited and sometimes slow network accessLimited or awkward input: soft keyboard, phonekeypad, touch screen, or stylus Limited web browser functionality Range of platforms & configurations acrossdevices31

Mobile Applications What are they?– Any application that runs on a mobile device Types– Web apps: run in a web browser HTML, JavaScript, Flash, server-side components, etc.– Native: compiled binaries for the device Often make use of web services32

Android Apps Built using Java and new SDK libraries– No support for some Java libraries like Swing &AWT– Oracle currently suing Google over use Java code compiled into Dalvik byte code(.dex)– Optimized for mobile devices (better memorymanagement, battery utilization, etc.) Dalvik VM runs .dex files33

Applications Are Boxed By default, each app is run in its own Linuxprocess– Process started when app’s code needs to be executed– Threads can be started to handle time-consumingoperations Each process has its own Dalvik VM By default, each app is assigned unique Linux ID– Permissions are set so app’s files are only visible tothat app34

Producing an Android AppJava code.javajavacByte code.classdxDalvik execlasses.dexByte codeOther .class filesaapt xml AndroidManifest.xml.apk str Resources35

Hello Android utorials/hello-world.html

Important Files src/HelloAndroid.java– Activity which is started when app executes res/layout/main.xml– Defines & lays out widgets for the activity res/values/strings.xml– String constants used by app gen/R.java (Don’t touch!)– Auto-generated file with identifiers from main.xml, strings.xml, andelsewhere AndroidManifest.xml– Declares all the app’s components– Names libraries app needs to be linked against– Identifies permissions the app expects to be granted37

src/HelloAndroid.java Activity which is started when app executes38

res/layout/main.xml Declares layouts & widgets for the activityTree from: .html39

Various rials/views/index.html40

Various rials/views/index.html41

res/values/strings.xml String constants used by app Used for supporting Localization– res/values-es/values/strings.xml to support Spanish– res/values-fr/values/strings.xml to support French– Etc.42

gen/R.java Auto-generated file with identifiers from main.xml,strings.xml, and elsewhereDo notmodify!43

AndroidManifest.xml Declares all the app’s components Names libraries app needs to be linked against Identifies permissions the app expects to be granted44

Four Application Components1. Activities– Presents a visual UI for a single endeavor– Single app may be composed of several activities– Examples: list of photos, buttons to start/stop a song2. Services– Performs background work (no UI)– Examples: play background music, retrieve data over a network3. Broadcast Receivers– Receives and reacts to broadcast announcements (no UI)– Broadcast examples: battery is low, pic is taken, lang pref changed4. Content Providers– Provides app data to other applications (no UI)– Examples: share contact info from SQLite, image from the file system 45

Typical GameHigh ScoresActivitySplash ScreenActivityMain MenuActivityGame PlayActivitySettingsActivityConder & Darcey (2010), Fig 4.1, p. 7446

rence/android/app/Activity.html47

Lifecycle Demo48

Intents Activities, services, & broadcast receivers areactivated by intents– Intents are asynchronous messages– May include data to be passed betweencomponents– Example: A Service starts an Activity to pick aphoto by using an intent. The photo is returned tothe Service also using an intent.49

Intent DemoIntent holdinghello countstartActivityForResult()HelloAndroidIntent holdingcheckbox boolSecondActivitysetResult()50

Data Storage App’s data is private– Can be shared using content providers Four ways to store data:1. Preferences: Lightweight mechanism to store andretrieve key-value pairs of primitive data types2. Files: Store on mobile device or on a removablestorage medium3. Databases: SQLite4. Network: Store/retrieve data stored elsewhere51

Common Interface Issues Menus– Options menu– Context menu Touch gestures––––––Tap/TouchLong pressDouble tapPinch & spreadFlick/swipeDrag Responsiveness52

Options Menu Activated by pressing MENU button More than 6 items show in expanded menu53

Context Menu Activated by long touch on item Most intuitive command should be listed first Many users never see or use them, so items should usually be /practices/ui guidelines/menu design.html54

Touch Gestures Tap or touch– Most common action– Used to select item Long press– Launch context menu orother intuitive action Double tap– Toggle zoom-in and zoomout Flick or swipe– Switch between screens orscroll content Drag– Scroll, move items, or drawa path Custom gestures– android.gesture package Pinch & spread– Zoom-in and outImage: stures.html55

http://www.lukew.com/touch/TouchGestureGuide.pdf56

Responsiveness Most important UIconsideration is responsiveness If app ignores input event for 5seconds, Android displays thedreaded Application NotResponding (ANR) dialog Often caused by performinglengthy operations like waitingfor network response or AI todecide next moveImage: n/responsiveness.html57

Avoiding ANR Most apps run on a single thread Any activity which may take a long timeshould be delegated to a child thread Use progress bars to give users feedback whenlengthy activities are being performedShort waitLong wait58

Tic-tac-toe59

SDK Samples60

Setup Development Environment Install JDK 6 Install Eclipse IDE for Java EE Developers (version 3.5 or 3.6) Download and unpack the Android SDK Install Android Development Tools (ADT) plugin for Eclipse Using the Android SDK and AVD Manager, add the SDK Platform Android 2.2, API 8 package

Related Documents:

is licensed under a Creative Commons License (Attribution-NonCommercial-NoDerivs 3.0 Unported) You are free to share: Copy, Quote, Distribute and Transmit the Survey Attribution: you must attribute the work in the manner specified by the author or licensor (but not in any way tha

Part of theAdministrative Law Commons,Banking and Finance Law Commons,Property Law and Real Estate Commons, and theSecurities Law Commons This Article is brought to you for free and open access by Digital Commons @ Boston College Law School. It has been accepted for inclusion in Boston

VCU Scholars Compass Theses and Dissertations Graduate School 2017 Read-In Arts An Liu Follow this and additional works at: https://scholarscompass.vcu.edu/etd Part of the Art Education Commons, Early Childhood Education Commons, Environmental Design Commons, Interior Architecture Commons, and the Urban, Community and Regional Planning Commons

credit to the various marketing channels based on their performance. Sales Stages in Attribution Models Sales stages in attribution models display the stages that are commonly involved in a sales funnel. The default stages that are available in Zoho CRM's attribution models are: Le

Through Creative Commons: An Industry Engagement and Action Agenda. The document clearly states on the inside of the front cover that the report is licensed under a Creative Commons Attribution 2.5 Australia licence, granting you the right to copy, communicate or adapt the report “ so long as you attribute the Australian Research Council

This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License Newcastle University ePrints - eprint.ncl.ac.uk Neaimeh M, Hill GA, Guo W, Wardle J, Bramich A, Blythe PT.

the Core Knowledge Foundation made available through licensing under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. This does not in any way imply that the Core Knowledge Foundation endorses this work. Noncommercial — You may not use this work for commercial purposes. Share Alike — If you alter, transform, or

This book is meant to provide a thorough introduction to Description Logics, equently,thebookisdividedintothreeparts: Part I introduces the theoretical foundations of Description Logics, addressing some of