CPS251 Android Development by Scott Shaper

Android Studio Tour

Android Studio is the official Integrated Development Environment (IDE) for Android application development, based on IntelliJ IDEA. On top of IntelliJ's powerful code editor and developer tools, Android Studio offers even more features that enhance your productivity when building Android apps, such as a flexible Gradle-based build system, a fast and feature-rich emulator, and a unified environment where you can develop for all Android devices. Here's a detailed tour of the Android Studio interface to help you navigate and utilize its features effectively.

As you read through this tour open the Android application and follow along.

Getting Started with Android Studio

When you first launch Android Studio, the welcome screen presents several options:

Main Window

After opening or creating a project, you'll see the main window divided into several areas:

tour

A. Toolbar

At the top, the toolbar provides quick access to run and debug tools, apply changes to the running app, AVD Manager (Android Virtual Device), and more. It includes:

B. Navigation Bar

Right below the toolbar, the navigation bar allows you to quickly navigate the structure of your project and open files for editing.

C. Editor Window

This is the central area where you code. It provides tabs for open files, code linting, syntax highlighting, and intelligent code completion.

D. Status Bar

At the very bottom, the status bar shows the status of your project and IDE, like the current branch you're working on, memory usage, and any background processes.

E. Project Window

On the left side, this window shows a hierarchical view of the components in your project, including:

Tool Windows

Various tools can be accessed from the buttons on the right, bottom, and left sides of the main window:

tools

 

Compose Editor

When you open a kotlin file which it written to use composeables, you have the option of opening a preview window to see the application. In the Starter Application that is given at the end of chapter 1. The following block of code has been provided to allow the preview to work

@Preview(showBackground = true, showSystemUi = true)
    @Composable
    fun helloClassPreview(){
        helloClass() // Show the same UI as the main function
    }

The @Preview annotation includes two settings:

Inside the function, the helloClass() is applied, which wraps the UI in the app's defined visual style (colors, typography, etc.). The helloClass() composable is the actual screen or component being previewed.

When you have the MainActivity.kt file open if you click the split icon split or design in the top right corner the preview screen will appear. The screenshot below shows what it looks like using the split screen.

preview

When you first start it you will have to engage the preview and you do that by clicking the link that states something like "Build & Refresh...". In some cases you will have to engage it first which means you will have to click a link inside the preview box that will say something like "Click here to build and refresh". This preview is very useful if you want to be able to view your app screen as you write it. It will update it in real time as you write your code. If it doesn't you can always just click the part in the upper left stating something like "Click here to update".

A really nice feature of the previews you can also put it into interactive mode where you can test your project out to see if it's working there are some limitations however.