Building Android Applications

This page is based primarily on Kristin Marsicano, Brian Gardner, Bill Phillips, and Christ Stewart’s Android Programming: The Big Nerd Ranch Guide (2019).

Some High Level Things To Know

  • Generally, Android apps are written in either Kotlin or Java.
  • Android has lived over many versions, you can support the majority of Android devices by supporting Android 5.0+ (API Level 21+).
  • Use Android Studio, built on JetBrains IDEA IDE, it is available free and bundles everything you’ll need to start developing.
  • “An activity is responsible for managing user interaction with a screen of information.”
    • Android provides the base Activity class, app classes will be sub-classes of this class.
  • “A layout defines a set of UI objects and the objects’ positions on the screen. A layout is made up of definitions written in XML.”
  • AndroidX (Jetpack) provides libraries one interacts with when developing.
    • Historically this was provided as a single library, Jetpack does away with this model allowing individual libraries to be updated without requiring all libraries to be.
  • Resources are non-code files and can include a variety of file types, including XML (which is used for layouts).
    • Resources are kept in app/res
    • Layouts are in /res/layout/
    • String Files are in /res/values/
    • Resources can be accessed using R.nameoftype.nameofresource.

Android Studio

  • Usually divided into several “tool windows.” On the left is Project on the bottom is Build, and the main window is the Editor.
  • Design/Text Views
  • Design/Blueprint Preview
  • Layout Decorations
  • Build Tool


  • When creating an activity use the extension .kt (convention).
  • Layouts are named after the activity they work with in snake_case (convention).
  • Classes are found in app/java, ignore the java naming, you can use Kotlin.


  • “Views are the building blocks you use to compose a UI. Everything you see on the screen is a view. Views that the user can see or interact with are called widgets.”
    • “Every widget is an instance of the View class or one of its subclasses (such as TextView or Button.”
  • ViewGroups (aka layouts) are containers for other buttons and allow one to control how the contained views appear.
    • Views within a ViewGroup are “children.”
  • “Every widget has a corresponding XML element, and the name of the element is the type of the widget.”
    • “Each element has a set of XML attributes. Each attribute is an instruction about how the widget should be configured.”
  • View Hierarchy – A hierarchy of View objects in which widgets exist.
    • Even your root view will have a parent, the view on Android in which the app lives.
  • LinearLayout – To make views appear on a single row or column.
  • Strings File – Where one keeps string resources (res/values/strings.xml), called using @string/nameofresource

Common Widget Attributes

  • android:layout_width and android:layout_height
    • match_parent makes the view as big as its parent.
    • wrap_content makes view as big as needed to contain its content.
  • android:padding
  • android:orientation – Choose between vertical and horizontal alignment for children views.
  • android:text

Common Code

  • Inflate View: Activity.setContentView(layoutResID: Int)