EDWARD'S LECTURE NOTES:
More notes at http://tanguay.info/learntracker
C O U R S E 
Programming Mobile Applications for Android
Adam Porter, University of Maryland
https://www.coursera.org/course/android
C O U R S E   L E C T U R E 
Developing an Android App
Notes taken on June 17, 2014 by Edward Tanguay
•
four kinds of application components
•
1. Activity
•
users see these
•
enables users to give and receive
•
2. Service
•
supports long-running background operations
•
3. Broadcastreceiver
•
listens for and responds to device events
•
4. Contentprovider
•
stores and shares data between multiple applications
•
applications have any number of the above kinds of components
•
implemented as Java classes
•
Activity class
•
primary class for user interaction
•
an activity should provide a single, focused thing for a user to do
•
e.g. phone dialer
•
DialtactsActivity.java
•
a sub-class of Activity
•
Service class
•
run in the background
•
run away from UI thread
•
e.g. music application
•
allows music to continue playing even when you move to another app
•
users a service to play the music file
•
BroadcastReceiver
•
listens for and responds to events
•
events are represented by the intent class
•
use e.g. sendBroadcast
•
e.g. the messaging application
•
someone wants to send me an SMS message
•
arrives at my phone
•
Android sits and waits for SMS messages to arrive and when one arrived, publishes an SMSmessageReceived intent
•
Content Providers
•
stores and shares data across applications
•
use database-style interface
•
handle interprocess communication
•
e.g. browser application
•
browser opens bookmarks in a Content
•
BrowserProvider extends ContentProvider
•
more complex application with two activities
•
MapLocation
•
user enters address
•
presses button
•
building an application
•
you get an apk file
•
apk is signed to identify the developer
•
steps
•
1. define resources
•
apps are more than source code
•
layout files
•
strings
•
animations
•
images
•
you can easily alter these resources
•
e.g. strings
•
individual strings
•
arrays of strings
•
plurals
•
e.g. book/books
•
in java, you refer to them as R.string.string_name
•
implement applicatoin classes
•
package application
•
install and run application
•
you can add another language of strings by adding a directory, e.g.
•
videos-fr