Intro to Android Development
  • Welcome
  • Syllabus
  • Hack Challenge
  • Resources
    • Lecture Videos
    • Ed Discussion
    • Git & GitHub Help/How-To
    • Setting up Android Studio
    • Starting an Android Studio Project & Making an Emulator
    • Importing, Exporting, & Submitting Your Projects to CMS
  • SP25 Course Material
    • Week 1 | Course Logistics, Kotlin, & Basic UI
      • Relevant Links
      • Demo/Lecture: Eatery Card
      • A0: Eatery Card (Follow-Along)
    • Week 2 | States, Components, LazyColumn
      • Relevant Links
      • Demo: Todo List
      • A2: Shopping List
    • Week 3 | Navigation & Animations
      • Relevant Links
      • Demo: Onboarding
      • A3: Stock Trading (RobbingGood)
    • Week 4 | MVVM and Flows
      • Relevant Links
      • Demo: Eatery Card 2
      • A4: Chat of a Lifetime
    • Week 5 | Dumb Components & UIEvents
      • Relevant Links
      • Demo: Music Player
      • A5: Rate My Vibe
    • Week 6 | Coroutines, Networking, JSON
      • Relevant Links
      • Demo: Retrofit
      • A6: You Should Even Lift, Bro.
  • Bonus Week | Android Job Search
    • Relevant Links
    • Android Technical Interview Question!
  • Textbook
    • 1. Introduction to the Editor and Views
      • 1.1 Introduction to the Editor
      • 1.2 SDK Management
      • 1.3 Kotlin Overview
      • 1.4 Views
      • 1.5 Android Studio Project Demo + Understanding The Editor
    • 2. Jetpack Compose
      • 2.1 Introduction
      • 2.2 Layouts
      • 2.3 Modifiers
      • 2.4 Animations
      • 2.5 Lazy Lists
      • 2.6 Reactive UI
    • 3. Intents and Manifest
      • 3.1 Activities
      • 3.2 Implicit Intents
      • 3.3 Explicit Intents
      • 3.4 Manifest
      • 3.5 Permissions
      • 3.6 Summary
    • 4. Navigation
      • 4.1 Types of Navigation
      • 4.2 Implementation of the Bottom Navigation Bar
    • 5. Data and Persistent Storage
      • 5.1 Singleton Classes
      • 5.2 Shared Preferences
      • 5.3 Rooms
      • 5.4 Entities
      • 5.5 Data Access Objects
      • 5.6 Databases
    • 5.5 Concurrency
      • 5.5.1 Coroutines
      • 5.5.2 Implementation of Coroutines
      • 5.5.3 Coroutines with Networking Calls
    • 6. Networking and 3rd Party libraries
      • 6.1 HTTP Overview
      • 6.2 3rd Party Libraries
      • 6.3 JSON and Moshi
      • 6.4 Retrofit
      • 6.5 Summary
    • 7. MVVM Design Pattern
      • 7.1 Key Idea
      • 7.2 Implementation Ideas
    • 8. Flows
    • 9. The Art and Ontology of Software
    • 10. 🔥 Firebase
      • 10.1 Setting up Firebase
      • 10.2 Authentication
      • 10.3 Analytics
      • 10.4 Messaging
      • 10.5 Firestore
  • Additional Topics
    • Git and GitHub
    • Exporting to APK
  • Archive
    • Archived Native Android Textbook Pages
      • 1. Layouts and More Views
        • 1.1 File Structure and File Types
        • 1.2 Resource Files
        • 1.3 Button and Input Control
        • 1.4 ViewGroups
        • 1.5 Summary + A Note On Chapter 2 Topics
      • 2. RecyclerViews
        • 2.1 RecyclerViews
        • 2.2 RecyclerView Performance
        • 2.3 Implementation of a Recycler View
        • 2.4 Implementation with Input Controls
        • 2.5 Filtering RecyclerViews
        • 2.6 Recyclerview Demo
      • 3. ListViews and Searching
        • 3.1 ListView vs. RecyclerView
        • 3.2 ListView Performance
        • 3.3 Implementation of a ListView
        • 3.4 Searching in a List View
      • 4. Fragments
        • 4.1 What are Fragments?
        • 4.2 Lifecycle of a Fragment
        • 4.3 Integrating a Fragment into an Activity
        • 4.4 Sharing Data Between Fragments
        • 4.5 Fragment Slide Shows
      • 5. OkHttp
      • 6. Activity Lifecycle
      • 7. Implementation of Tab Layout
    • Fall 2024 Course Material
      • Lecture 1 & Exercise 1: Introduction to Android
      • Lecture 1.5: Beauty of Kotlin
      • Lecture 2 & HW 2: Modifiers, Lazylists and Reactive UI
      • Lecture 3 & HW 3: Animations, Intents and Manifest
      • Lecture 4 & HW 4: Coroutines & Navigation
      • Lecture 5 & HW 5: Persistent Storage, Networking, and JSON Parsing
      • Lecture 6 & HW 6: MVVM, Flows
      • Bonus Lectures & Bonus HW
      • Bonus Lecture: Industry Practice
    • Spring 2024 Course Material
      • Lecture 1 & Exercise 1: Introduction to Android
      • Lecture 4 & HW 4: LazyLists
      • Lecture 6 & HW 6: Networking, Data, and Persistent Storage
    • Spring 2020 Course Material
      • Week 1: Intro to the Editor
      • Week 2: Views and Layouts
      • Week 3: Intent and Manifest
      • Week 4: ListView and RecyclerView
      • Week 5: Fragments
      • Week 6: Networking
    • Spring 2021 Lecture & HW 8: Networking & 3rd Party APIs
    • HackOurCampus Workshop
Powered by GitBook
On this page
  • Setting up a new Android Studio project
  • Understanding files in Android Studio
  • Exploring the editor
  • Creating and running an emulator
  • Demos

Was this helpful?

  1. Textbook
  2. 1. Introduction to the Editor and Views

1.5 Android Studio Project Demo + Understanding The Editor

Previous1.4 ViewsNext2. Jetpack Compose

Last updated 7 months ago

Was this helpful?

Setting up a new Android Studio project

  1. Click File > New Project > Empty Activity > Next. For most of your projects, you'll want to start with an empty canvas. There are also many pre-made templates for different type of screens, which may be helpful to check out if you're working on a quick prototype. In general, we pick an empty activity to avoid having to deal with boilerplate code.

2. Fill in the input fields for project name and save file location (on computer). It is also important to verify that the language is set properly to Kotlin or Java at this step; however, it'll require more work later to switch the primary language for this codebase.

It is also important to find a minimum SDK that is low enough to encompass most app users, but high enough that the application can support cool and new features. We recommend using minimum SDK 23, and you can always increase the minimum SDK later in the codebase as needed.

Understanding files in Android Studio

Android Studio will repopulate the editor with pre-made files so that the app can compile and run even without you needing to write any code!

The different files include:

  • MainActivity: This is your Kotlin/Java file that contains all the logic to your app. If you open the file, you'll notice that all it does by default is populate the view on an onCreate() event. (This is called when the app first launches).

You can think of an activity as a screen inside your application, for now. We will talk about more complex screens in Lecture 6 and beyond.

  • res: This folder contains all the resources needed in your app:

    • drawable: contains app icons and images

    • layout: XML layouts used in the app

    • values: values for color, strings, styles, etc.

  • AndroidManifest.xml: This file contains information about the activities in your project, granted permissions and intents, and other system-level information. For the most part, you shouldn't need to touch this file unless you are adding new permissions.

  • build.gradle(module): This file is where you set the basic configuration for the app, which is useful when you upload your project to the Google Play Store. You can also add plugin and import third-party libraries here.

These files and folders above are the most important ones that you will probably be editing as you develop an app. If you find yourself editing other files, double check that you can editing the right files!

Check out this page if you want to learn more about the difference between a layout and a class file:

Exploring the editor

This page has a good overview of the different components of the editor:

Some additional components of the IDE that you may use include:

  • Logcat: This window allows you to see and filter through system debugging messages, which is super useful for debugging code.

  • SDK Manager: This window allows you to view and download new SDK packages that you want your application to support. This is really useful for when you want to work with new features on Android and need a higher SDK level.

  • Layout Inspector: This shows you the hierarchy of all the visual components in your app as well as the constraints and values used, and this is a great debugging tool for when you are creating UI dynamically.

Creating and running an emulator

  1. Open the AVD Manager from the top toolbar.

2. Click Create Virtual Device and specify the device specs and system image that you want your emulator to have.

3. Once you finish building your device, you'll see it in the list of created virtual devices. When you click run, the device will be created with your app already installed. Your device should look something like this:

Demos

1.1 File Structure and File Types
1.1 Introduction to the Editor
34MB
AndroidProject1.zip
archive
Demo Used in Lecture 1
28MB
MyApplication2.zip
archive
Component Customization Exercise Solution for Discussion 1
Project Template dialog window
Project Configuration page
File Structure in Andorid S
Logcat window
SDK Manager
Layout Inspector
Device Dropdown
Virtual Device Configuration Window
Nexus Emulator