A Quick Guide to Android Studio

What is Android Studio?

Android Studio is a Java-based operating system developed by google and is the official Integrated Development Environment ("IDE") for developing Android applications. Android Studio is based on IntelliJ IDE, on top of IntelliJ's powerful code editor and developer tools, Android Studio offers even more features that enhance productivity when building Android applications.

The latest version of Android Studio is available for download here.

How to Install Android Studio?

Before you can install Android Studio on your device, you need to have Java and the Java SDK already installed on your operating system. If you already have Java and the Java SDK on your operating system, make sure they are the most recent versions available by the distributor. You can download both from the Oracle website.

Before we delve into using Android Studio and coding an Android application, there are some basic concepts about the AS JDK/IDE that will make coding on the platform simpler and comprehensible.
The Application Package

A package contains the source code for your application. The Android Studio JDK creates a default package when you start a new application. The default package contains an "app" folder and a "gradle Scripts" folder.

Folders

The App folder contains a “manifest” folder, a “java” folder, a "generatedJava" folder and a "res" folder. We will examine what each of these folders contain and the sort of work you can expect to person in each.

The “gradle” folder, contains files that handle compiling, testing, deploying and converting your code. Simply put, Gradle automates the process required to organize all the different parts of our code into a compressed file, going from the original source code to binary code and testing the binary code. The Android Studio JDK comes with two pre-loaded gradle files for each project, build.gradle (Project: YourProjectName) and build.gradle (Module:app). Subsequent gradle folders are created as you expand your code.

The Emulator

The Android Studio emulator is an downloadable component that allows you to simulate an android device on your computer in order to test your application virtually. You can install the Android Emulator by going to “Tools” and selecting “SDK Manager”. This will launch a new window, go to the “System Settings” tab and click on “Android SDK” to ensure that you have the “Android SDK Build-Tools” installed.

Then click on “Tools", “Android AVD Manager" and press the “Create Virtual Device” to create your emulator.


Let’s Built a basic application:
  1. Open Android Studio. On the “Welcome To Android Studio” display window, click on “+ Start a New Android Studio Project”
  2. This will prompt you to a new page with pre designed templates. Click on “Basic Activity”. Designate a title for your application in the “Name” column.
    • You can also specify where you want your application package to save on your desktop and the programing language you prefer to use when coding your application. The default programing language is “java” and for this tutorial, we will be using the “java” programming language.
  3. A new “window” will launch, where you will perform all the basic functions that you’ll need to build your application. On the left side of the window are a series of closed tabs. Click on the “project” tab to get access to the folders that encompass the many parts of your application.
  4. Click on the “app” folder, then get each of the subsequent folders to get a sense of what they do. The major folders you will be working out of include the: “java” folder, the “res” folder and it’s subfolders (layout, menu, values and possibly drawables”).
  5. As you click through each older, you should see a visual representation of the content in the folder displayed in the middle of the window. This is not the emulator, but it helps you get a sense of what your application looks lie.
  6. To the far right, you’ll see two closed tabs, “Palette” and “Attributes”. These will provide you with the resources to stylize your application.
  7. Click on the layout folder. Click on the “content_main.xml” file. Delete the “Hello World” text box in the middle of the page.
  8. On the “Palette” tab you can add features such as buttons, other types of text containers, navigation bars and so on, to your application.
    • Editing values: There are several ways to edit values such as “strings”, “color", and “text size” on the Android Application. You can edit some of this content through the “Attributes” tab, but this can be limiting and is not always available for every feature you may include in your application. Another way to edit the values of attributes and content on your application, is to open the “values” folder, go to the type of value you want to change, so for example if you want to change colors, you’ll go to the colors.xml, if you want to change the string values, go to the strings.xml. You can use the dimens.xml to handle font size, object parameters and more.
    • Once you have inputed the values you want to use, you’ll need to retrieve them from the values folder to your parent application. To do this, go to the layout folder, access the layout you want to add the value to. At the bottom of the page, click on the “Text” tab. This will change the view so that you are no longer seeing the visual representation of your application, but the source code. Here, you can call the value you want, add the new features, expand on the current features you have and so much more.
    • So for example if you want to change the background color of a button feature you have added to your application from the “Palette”, you’ll go to the section of your code that is tagged "button" and add the following snippet of code:

      android:background=“@color/color_from_color_value.xml”

  9. Once you are done adding features and attributes to your application, you can test the function and appearance of your application by clicking the green triangle button at the top of the navigation bar for the Android Studio JDK. This will launch the emulator and demonstrate how your application will function on a “real” Android device.
  10. As you work on your android application, expanding on the already existing features and adding new functionality to your application, here are some quick tips that can help you along the way:
    • Debug - Android Studio provides developers with the ability to run a debugger which helps capture errors and potential errors in your application. Debuggers are great for fixing problems you might run into with your code.
    • Version Control - Most of us learned about saving drafts of our work back in elementary school. When writing your code it is imperative that you implement some sort of "version-control" method to help you keep track of your progress.
    • GitHub - Upload your source code onto GitHub to help you maintain and preserve your code. Using Git is a great way to streamline/simplify four version-control since Git can automatically mark changes that occur on your application.
Application: A software application is a program or collection of programs designed to perform certain functions, tasks, or activities for an end-user.
C++: C++ is an object oriented programming language, as one of the most powerful programming langauges in the world, it is widely used. You can learn more about C++ with CodeAcademy.
CSS: Cascading Style Sheets ("CSS") is a language that describes the style of an HTML document. w3schools.com offers basic CSS training.
Hardware: A computer's hardware are the physical components that make up a computer or electronic system and could include, monitors, hard drives, CPUs, keyboard, and mouse.
HTML: Hypertext Markup Language ("HTML") is the standard language used for creating web pages.
IDE: An Integrated Development Environment is a software that contains a text-editor (for writing your code), a bebugger and tools for running applications.
Java: Java is one of the most popular object oriented programming languages that uses. Java evolved from C++. Java is the most secure programming language, reliable, easy to use, and platform independent.

Learn some java basics with CodeAcademy.

JavaScript: Javascript is a high-level interpreted programming language and was the first scripting language supported by web browsers. Javascript, HTML and CSS together make up the core technologies of the WWW.
Kotlin: Kotlin is an open source object-oriented programming language developed by JetBrains to outperform Java. Kotlin is supported by Google for Android mobile development.
Operating System: An OS is a software/program (usually large) that manages and controls the hardware of other software/program on a computer, this includes enabling the hardware to communicate and operate wih the software/program.
User Interface: The User Inferface ("UI") defines the space and or mechanisms where the user and a machine interact.

How to Install Android Studio

Sample Android Studio