This presentation introduces the mobile operating system Android, including:
Android uses a multi-layered software architecture, with:
An application (app) is composed of screens. Screens are composed of: Example: a layout might include a button, described in XML, while Java code describes what happens when the button is pressed.

Activities comprise the application logic, which manages data and controls user navigation. It uses the non-GUI parts of the JVM specification.

Applications use a build tool called Gradle, which uses Groovy as its scripting language.

Up till Android 5.0, a Google implementation of the JVM called Dalvik was used for the application logic.

In December 2015, Google announced that the next version of Android would switch to a Java implementation based on OpenJDK.

In 2010, Oracle sued Google over the use of Java, arguing that Oracle held the copyright to the Java APIs.

The official IDE (integrated development environment) for Android is Android Studio. Features:
The instructions below are for installing and using Android Studio on your own machine. Note: You can also install Android Studio on your personal UMD disk space and run it on the development machines in Heller Hall 314.
To begin, click on Create New Project.

You will be asked to select a project template. An activity is Java code that defines what an application does.

For now, choose an "empty" activity:

`
After providing a name and location of your project, you will be asked to select the target devices for your app (see image below).

An activity is Java code that defines what an application does.

For now, choose an "empty" activity:

When an activity is created, an activity name and associated layout name are chosen.

For now, choose the defaults:

After dismissing a window offering the "tip of the day," you will see the following layout of the IDE workspace.

Note the similarity to NetBeans: project navigation on the left, and file contents on the right.

Below we see the Java class MainActivity displayed. It refers to the layout expressed by activity_main.xml.

There are two views of the application's layout:

After clicking on the activity_main.xml tab, the layout is displayed.

Below we see the design view of a default layout, obtained by clicking Design in the upper right:

Below we see the text view of a default layout, obtained by clicking Code in the upper right.

Generally, the code view gives one more control over aspects of the layout than the design view.

Applications can be run either by connecting an actual Android device to your system, or running the Android Emulator (also Android Virtual Device, or AVD), which recreates the exact hardware environment of an Android device.

In either case, click Run on Android Studio's menu bar and choose Run 'app' as shown below.

Note the field just under the menu bar that contains "Nexus 6 API 25". This indicates that the app will be run on a virtual device emulating a Nexus 6 whose Android API level is 25.

Virtual devices are described below.

The procedure to connect an actual device (an Android phone or tablet) to a machine running Android Studio depends on the machine. If you have successfully connected a device, it will appear in the device drop-down as shown below.

Here an actual LG device has been connected to the computer and selected from the drop-down. Now when the app is run the LG device will be used.

If no physical devices are connected, Android Studio will detect this, and you will need to create a new virtual device, or emulator.

This requires two top-level steps:

Start by clicking Create New Virtual Device.

Select the Phone category and a suitable device before clicking Next.

When no system image is detected, Android Studio will offer the opportunity to download one, as shown below.

Click Download next to a chosen image. You will be required to accept a license agreement.

The system image is a tool in the Android SDK. Downloading and installing may take a few minutes:

After downloading and installing, the system image can be selected.

Note that the API level of the system image is the API level of the virtual machine implemented by the image:

Once the system image is selected, click Next.

If successful, you will see a screen like that below. Click Finish.

Now select the virtual device you just created and click OK. This will launch the emulator.

Note that once you create an emulator, Android Studio will retain it until you delete it.

The emulator is a full virtual implementation of Android running on a device. It is not a simulator (as with iPhone), which runs natively on Macs.

The Android emulator is therefore slower, but it is richer and more realistic than a simulator.

Here is a rendering of the emulator's interface, along with its control panel:

To those with Android devices, the emulator interface is familiar. Below is the screen after swiping to the right.

Swiping can be performed with the mouse, or, if your machine has a touch-sensitive screen, by swiping just as you would on a phone.

Below is the app screen, obtained by swiping up on the home screen.

Note that My Application appears at the top.

Here is the result of clicking (touching) My Application.

Here is a link to the Android API.