48
Android Application Development android.cs.uchicago.edu

Android Application Development android.cs.uchicago.edu

Embed Size (px)

Citation preview

Page 1: Android Application Development android.cs.uchicago.edu

Android Application Development

android.cs.uchicago.edu

Page 2: Android Application Development android.cs.uchicago.edu

Adam Gerber, PhD, SCJP

Some of my mobile work:

Introductions:NameWhere are you from?Your experience with mobile and java?What you want to get out of this class?

Page 3: Android Application Development android.cs.uchicago.edu

Unit00: Setup

Page 4: Android Application Development android.cs.uchicago.edu

1/ Install required software:java-sdk 7, Android Studio, git, sourcetree

2/ Set-up steps (projects and labs)

3/ A tour of the course website and policies: android.cs.uchicago.edu

4/ A tour of git-bash and SourceTreea) add, reset, commit, F5, foldersb) amendc) branchd) push/remotes

5/ A tour of Android Studio (shortcuts, VCS, etc.)

Page 5: Android Application Development android.cs.uchicago.edu

http://www.perforce.com/product/components/perforce-visual-merge-and-diff-http://www.perforce.com/product/components/perforce-visual-merge-and-diff-toolstools

Page 6: Android Application Development android.cs.uchicago.edu

Lab 2g

Page 7: Android Application Development android.cs.uchicago.edu

Lab 2g

Page 8: Android Application Development android.cs.uchicago.edu

Lab 2g

Page 9: Android Application Development android.cs.uchicago.edu

Lab 2m

Page 10: Android Application Development android.cs.uchicago.edu

Your laptopYour laptop

bitbucket.org/jstudent/labJavabitbucket.org/jstudent/labJava

Lab 2m

Page 11: Android Application Development android.cs.uchicago.edu

Projects

Page 12: Android Application Development android.cs.uchicago.edu

Projects

Page 13: Android Application Development android.cs.uchicago.edu

Projects

Page 14: Android Application Development android.cs.uchicago.edu

Projects

Page 15: Android Application Development android.cs.uchicago.edu

Download and install required software:

Java SDK (7): www.oracle.com/technetwork/java/javase/downloads/index.html

Android Studio: developer.android.com/sdk/installing/studio.html

Git: git-scm.com

SourceTree: www.sourcetreeapp.com

Page 16: Android Application Development android.cs.uchicago.edu

GIT architecture

Page 17: Android Application Development android.cs.uchicago.edu

git config --global user.name "Your Name"git config --global user.email "[email protected]"

Page 18: Android Application Development android.cs.uchicago.edu

add/reset/commit:

move files from working-dir to stage-dir(aka index)git add .git add res/.git add src/.git add res/values/strings.xml

move files from stage-dir(aka index) to working-dirgit reset HEAD .git reset head res/.git reset head src/.git reset head res/values/strings.xml

git commit -m “your commit message.”

Page 19: Android Application Development android.cs.uchicago.edu

Amending:

Every commit is associated with a sha-1 hash. That hash is derived from 1/ the file changes in that commit and 2/ the previous commit.

You can not change any commit unless that commit is at the head. Since no other commits depend on the head, you may safely change the head.

To change the head, usegit commit --amend -m “your message”git commit --amend --no-edit

Page 20: Android Application Development android.cs.uchicago.edu

Branching: To list the branches in a project:git branchgit branch -r git branch --all To create a branch: git checkout -b branchName c39bgit checkout -b branchName

To delete a branch:git branch -D branchName

To checkout a branch:git checkout 7afegit checkout master

Page 21: Android Application Development android.cs.uchicago.edu

Pushing to remotes:

To see the remotes:git remote -v show To push to a remote:git push origin mastergit push --all

To clear all local changes since last pushgit reset --hard origin/master

Page 22: Android Application Development android.cs.uchicago.edu

Reverting (does the exact opposite)

git revert 0da8 --no-editgit revert head --no-editgit revert head~3 --no-edit

To clear all local changes since last pushgit reset --hard origin/master

To delete a remote branchgit push origin :branchName

Page 23: Android Application Development android.cs.uchicago.edu

Android Studio

Default keymap:http://android.cs.uchicago.edu/content/slides/keymap.pdf

File || settings || keymap

Page 24: Android Application Development android.cs.uchicago.edu

Unit01: The Android Computing Platform

Page 25: Android Application Development android.cs.uchicago.edu

Android• Comprehensive open-source platform for mobile

devices

• Owned by Open Handset Alliance http://en.wikipedia.org/wiki/Open_Handset_Alliance

• Championed by Google

• Stated goal: "accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience."

Page 26: Android Application Development android.cs.uchicago.edu

Vision for Android

Page 27: Android Application Development android.cs.uchicago.edu

Android is NOT just phones

Tablets

Readers

Televisions

Game consoles

AR-Devices

Android Wear

Android is open-source, which means any manufacturer of mobile devices can drop Android onto it.

Page 28: Android Application Development android.cs.uchicago.edu

6/9/12

Page 29: Android Application Development android.cs.uchicago.edu

Android Version Distribution

Using the compatability (support) libraries, you can develop in 4.2 and min-build-target to 1.6.

Page 30: Android Application Development android.cs.uchicago.edu

Android Version History

http://en.wikipedia.org/wiki/Android_version_history

Page 31: Android Application Development android.cs.uchicago.edu

Code/Version/API map

http://source.android.com/source/build-numbers.html

Page 32: Android Application Development android.cs.uchicago.edu

Mods (skins) HTC Motorola Samsung | HTC Motorola Samsung

Page 33: Android Application Development android.cs.uchicago.edu

Open Handset Alliance

http://en.wikipedia.org/wiki/Android_(operating_system)

http://en.wikipedia.org/wiki/Open_Handset_Alliance

The OHA was established on 5 November 2007, led by Google with 34 members including mobile handset makers, application developers, some mobile carriers and chip makers.

Android, the flagship software of the alliance, is based on an open source license and competes against mobile platforms from Apple, Microsoft, Nokia (Symbian), HP (formerly Palm), Research In Motion, and Samsung Electronics (bada).

Headquarters: South Korea

Page 34: Android Application Development android.cs.uchicago.edu
Page 35: Android Application Development android.cs.uchicago.edu
Page 36: Android Application Development android.cs.uchicago.edu
Page 37: Android Application Development android.cs.uchicago.edu
Page 38: Android Application Development android.cs.uchicago.edu

iOS versus Android Revenue at POP

Page 39: Android Application Development android.cs.uchicago.edu
Page 40: Android Application Development android.cs.uchicago.edu

Android Architecture

Page 41: Android Application Development android.cs.uchicago.edu

6/9/12

Page 42: Android Application Development android.cs.uchicago.edu

Stock apps, all of which can be replaced; modular architecture.

Managers (APIs to OS). You will use these APIs in your apps.

SQLite and WebKit are in iOS as well. libc is from c. OpenGL is graphics, etc.

kernel components; you won't touch these.

Page 43: Android Application Development android.cs.uchicago.edu

android dex files are like java class files - they're bytecode, but they've been optimized for a resource constrained environment.

Page 44: Android Application Development android.cs.uchicago.edu

Android is modular

Page 45: Android Application Development android.cs.uchicago.edu

Building Blocks of an App• Activities (you can see an activity, activities

have views.)

• Intents (shuttle messages)

• Services (background services)

• Content Providers (api abstraction to datastore)

• Broadcast Receivers (capture OS broadcasts; such as battery-low, reboot, sms-received, headphone-plugged-in, etc. )

Page 46: Android Application Development android.cs.uchicago.edu

Some Developer Resources

Page 47: Android Application Development android.cs.uchicago.edu
Page 48: Android Application Development android.cs.uchicago.edu

Resources

Android Developer's Guide : developer.android.com/guide/index.html

Stack Overflow: stackoverflow.com/questions/tagged/android

Asset Studio: android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html

Android Views: www.androidviews.net