This document discusses the main components of Android apps: activities, services, broadcast receivers, content providers. It describes what each component is used for and its lifecycle. It also covers resources, packaging and installing apps, and the overall workflow for building an Android app from defining resources to running the app.
5. Apps are made from components
Android instantiates and runs them as
needed
Each component has its own purpose
and APIs
6. Primary class for user interaction
Usually implements a single, focused
task that the user can do
9. Runs in the background
to perform long-running operations
to support interaction with remote
processes
13. Component that listens for and responds to
events
The subscriber in publish/subscribe
pattern
Events represented by the Intent class
and then Broadcast
14. Component that listens for and responds to
events
The subscriber in publish/subscribe
pattern
Events represented by the Intent class
and then Broadcast
BroadcastReceiver receives and
responds to broadcast event
18. Store & share data across applications
Uses database-style interface
Handles interprocess communication
23. User enters an address
App displays a map of area around the
address
27. Resources are non-source code entities
Many different resource types, such as
Layout, Strings, Images, Menus, & animations
Allows apps to be customized for
different devices and users
See:
http://developer.android.com/guide/!
topics/resources
29. Types: String, String Array, Plurals
Typically stored in res/values/*.xml
Specified in XML, e.g.,
<string name="hello">Hello World!</string>
Can include formatting and styling
30. Accessed by other resources as:
@string/string_name
Accessed in Java as:
R.string.string_name
33. If your default language is Italian,
@string/location_string is
¡°Digita l¡¯indirizzo¡±
Otherwise,
¡°Enter Location¡±
36. UI layout specified in XML files
Some tools allow visual layout
XML files typically stored in
res/layout/*.xml
Accessed in Java as:
R.layout. layout_name
Accessed by other resources as:
@layout/layout_name
37. Can specify different Layout files based
on your device¡¯s orientation, screen size,
etc.
51. System packages application components
& resources into a .apk file
Developers specify required application
information in a file called
AndroidManifest.xml
55. From Eclipse run in the emulator or
device
From command line
Enable USB Debugging on the device
Settings > Applications > Development > USB
debugging
% adb install <path_to_apk>