The Rough Picture
- Android
- Android was created by the Open Handset Alliance which is lead by
Google.
- Android is a multi-user operating system based on Linux, with its own
virtual machine environment, Android Runtime (ART).
- Android applications are written in Java or Kotlin.
- The core runtime libraries are written in C using the Bionic standard
C library, and Java libraries are based on OpenJDK.
- Android versions are released periodically, but devices that run
old versions persist, so development has to target some earlier
version.
The Android Studio "Create New Project" wizard gives a feeling for
the percentage of devices covered by each version.
Right now ...

We'll target Android 9.0 API 28 - Pie.
- A (simple) Android application consists of a stack of activities.
- The OS starts the first activity.
- An activity can stack a new activity on top of itself.
- The activity on top of the stack is the one running for that
application.
- An activity can end itself, or can be ended using the device's
Back button.
- An activity can send data to an activity it starts, and return
data to the one that started it.
- Multiple applications can be running at once, but only the visible
ones are (kinda) guaranteed to stay alive.
- User interface (UI) elements allow user interaction
- Normally they are written in XML.
- They can also be created programmatically, if the elements are not
known in advance.
- Handler methods are used to react to user interactions.
- Android is designed to run on a variety of devices that offer
a range of screen sizes and resolutions.
If you do not provide code to deal with the device's size and
density, Android will (try to) scale everything for you.
- Compiling an application
- The Android SDK tools compile the code - along with any data and
resource files - into an Android package, an archive file with an
.apk suffix.
- An .apk file is considered to be one application, and is
the file that Android-powered devices use to install the application.
- An.apk package includes a manifest file,
AndroidManifest.xml
- The manifest file must declare all components in the
application, in particular all the activities.
- The manifest file should also declare all application
requirements, e.g., the minimum version of Android required.
- The manifest file must declare all permissions required,
e.g., use of certain hardware components.
- Application execution
- Execution is controlled by Android - generally an application has no
positive control (it can stop itself, but not start itself).
Applications must be ready to interrupted, stopped, and destroyed.
- Change your mindset ... your program does not control the
device ... the device controls your program