Lesson Weekend

When we start a new project, Android Studio creates all of the initial files and folders we need. We can see the structure of these files and folders in the panel on the left side of the screen.

There are a variety of different views to choose from that allow us to visualize our project structure. We will use the default Android project view as it provides quick access to the key source files of an Android project.

Note: Sometimes this panel does not automatically open along with your project. To open it manually, either type _Command + 1_ on a Mac, click on the vertical text\ _1:Project_ on the left side of the window, or select _View > Tool Windows > Project_.

Let’s run the My Restaurants project we just created to make sure everything is working. Type Ctrl + R or click the Run icon from the toolbar (the green play arrow).

From the Device Chooser menu, we can select the device we want to run our app on. We haven’t created a virtual device yet so let’s do that now.

We can create and manage our virtual devices in the Android Virtual Device (AVD) Manager. Select the AVD Manager icon (the little green android guy in front of the purple phone) in the toolbar and click Create a virtual device:

From here, we can choose from a variety of different hardwares to emulate. We will be concentrating on apps for mobile phones throughout this course so let’s choose a standard phone such as the Google Nexus 6.

Next we need to select a system image. A system image represents the version of Android we want on our virtual device. Let’s choose Marshmallow API 23 x86 with Google APIs which means it will come preloaded with Google apps such as Google Maps.

On the next screen, we are presented with a number of customization options. Here you can control the size of the emulator in relation to your computer’s screen size and even set the emulator’s camera to your computer’s built-in camera.

Now that we have created a device, let’s select it from the Device Chooser and hit OK. Android Studio takes a bit of time to load the emulator so it’s best to always keep it running in the background.

Once the emulator is done loading, we should be able to navigate to our app and interact with it.

Terminology


  • Android Virtual Device (AVD) Manager: A tool for the creation and management of virtual devices.

  • System image: A representation of the version of Android on a virtual device.

Tips


  • For this course we will use the Google Nexus 6 hardware and Marshmallow API 23 x86 for our standard emulator. Additionally, select the option to use the computer's built-in webcam as the emulator's camera.

Shortcuts


  • Ctrl + R will run the application in the emulator.