This work is licensed under the Apache 2.0 License
ANDROID WORKSHOP
This work is licensed under the Apache 2.0 License
AKA imselmon 😎
Salman Shaikh
Hey 👋 I’m Salman
(Zain)
Founder @ Scattr, Triplist
This work is licensed under the Apache 2.0 License
I do
An Dr. Strange of
Development Verse
Web, Mobile, and Cloud
Development
This work is licensed under the Apache 2.0 License
● Basic computer literacy
● Basic math skills
● Computer & headphones
● Internet connection
● (Optional) Android device & USB cable
Prerequisites
This work is licensed under the Apache 2.0 License
● Build your first Android apps
● Set up Android Studio on your computer
● Learn the basics of the Kotlin programming
language
● Learn Jetpack Compose
● Discover resources to continue learning
Learning Objectives
This work is licensed under the Apache 2.0 License
1. Why are you here?
2. What are you goals?
3. How do you plan to achieve them?
This work is licensed under the Apache 2.0 License
Who would like to share?
This work is licensed under the Apache 2.0 License
Android is an open-source operating
system (OS) for mobile devices, such as
smartphones, tablets, and smartwatches
What is Android
This work is licensed under the Apache 2.0 License
TOPIC
Presentation
W
H
W
H
Say Cheesss
Wrap up
Today’s Schedule
This work is licensed under the Apache 2.0 License
Android Basics
with Compose Course
This work is licensed under the Apache 2.0 License
Unit 1: Your first
Android App
This work is licensed under the Apache 2.0 License
A Pathway
This work is licensed under the Apache 2.0 License
Take a Quiz
This work is licensed under the Apache 2.0 License
Earn badges!
This work is licensed under the Apache 2.0 License
Session Overview
This work is licensed under the Apache 2.0 License
Kotlin Programming
Language
Use Kotlin to start writing Android
apps.
Kotlin helps developers be more
productive.
This work is licensed under the Apache 2.0 License
Kotlin Playground
Write and run Kotlin code
in
the browser.
This work is licensed under the Apache 2.0 License
Program
A series of instructions for a
computer to perform some
action.
fun main() {
println("Hello, world!")
}
Output:
Hello, world!
This work is licensed under the Apache 2.0 License
Code
Step by step instructions for
what the computer should do.
fun main() {
println("Hello, world!")
}
Output:
Hello, world!
This work is licensed under the Apache 2.0 License
main Function
The main function is the entry
point, or starting point, of the
program.
Start
here
fun main() {
println("Hello, world!")
}
Output:
Hello, world!
This work is licensed under the Apache 2.0 License
Functions
A function is a segment of a program that
performs a specific task.
You can have many functions in your program
or only a single one.
This work is licensed under the Apache 2.0 License
Defining a function
Functions begin with the fun
keyword.
fun displayIntroduction() {
}
This work is licensed under the Apache 2.0 License
Defining a function
Functions have a name so that
they can be called.
fun displayIntroduction() {
}
This work is licensed under the Apache 2.0 License
Defining a function
Functions need a set of
parentheses after the function
name in order to surround the
function inputs.
fun displayIntroduction() {
}
This work is licensed under the Apache 2.0 License
Defining a function
The curly braces make up the
function body and contain the
instructions needed to execute
a task.
fun displayIntroduction() {
}
This work is licensed under the Apache 2.0 License
Putting it together
fun displayIntroduction() {
// We will fill this out!
}
Output:
Hi I’m Meghan and I am 28 years old
This work is licensed under the Apache 2.0 License
A container for a single piece of
data.
Variables
This work is licensed under the Apache 2.0 License
My name is and I am
years old
Variables
name age
This work is licensed under the Apache 2.0 License
My name is and I am years old
Variables
Name value: Meghan
Age value: 28
Output:
My name is Meghan and
I am 28 years old
Name value: Janet
Age value: 49
Output:
My name is Janet and I
am 49 years old
name age
This work is licensed under the Apache 2.0 License
Basic data types
Kotlin Data type What kind of data it can contain Example literal values
String Text
“Add contact”
“Search”
Int Whole integer number
32
-59873
Double Decimal number
2.0
-37123.9999
Float
Decimal number (less precise than a
Double). Has an f or F at the end of the
number.
5.0f
-1630.209f
Boolean
true or false. Use this data type when there
are only two possible values.
true
false
This work is licensed under the Apache 2.0 License
val keyword
Use when you expect the variable value
will not change.
Example: name
var keyword
Use when you expect the variable value can
change.
Example: age
Defining a variable
This work is licensed under the Apache 2.0 License
Defining a variable
Variables start with a var or val
keyword.
fun displayIntroduction() {
val name: String = "Meghan"
var age: Int = 28
}
This work is licensed under the Apache 2.0 License
Defining a variable
All variables must have a name.
fun displayIntroduction() {
val name: String = "Meghan"
var age: Int = 28
}
This work is licensed under the Apache 2.0 License
Defining a variable
Data type is the type of data
that the variable holds.
fun displayIntroduction() {
val name: String = "Meghan"
var age: Int = 28
}
This work is licensed under the Apache 2.0 License
Defining a variable
The initial value is the value that
is stored in the variable.
fun displayIntroduction() {
val name: String = "Meghan"
var age: Int = 28
}
This work is licensed under the Apache 2.0 License
Putting it together
fun displayIntroduction() {
val name = "Meghan"
val age = 28
println("Hi I'm $name and I am $age years old")
}
This work is licensed under the Apache 2.0 License
Putting it together
fun main() {
displayIntroduction()
}
fun displayIntroduction() {
val name = "Meghan"
val age = 28
println("Hi I'm $name and I am $age years old")
}
Output:
Hi I’m Meghan and I am 28 years old
This work is licensed under the Apache 2.0 License
Break
This work is licensed under the Apache 2.0 License
Let’s get started
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Unit 1: Pathway 1
This work is licensed under the Apache 2.0 License
Work on Unit 1, Pathway 1
Have a Question?
Just ask
This work is licensed under the Apache 2.0 License
Work on Unit 1, Pathway 1
Have a Question?
Just ask
This work is licensed under the Apache 2.0 License
Welcome back
And congrats!
This work is licensed under the Apache 2.0 License
What’s coming next:
This work is licensed under the Apache 2.0 License
Learn More
This work is licensed under the Apache 2.0 License
HYYYYYYYYYOOOOOO
Optional resources to check out:
● Official Android Developers Site: developer.android.com
● Official Android Developers Blog (for announcements)
● Android Developers Medium Blog (for more technical
articles)
● Android Developers YouTube channel
● Follow @AndroidDev on Twitter
● Follow @AndroidDev on LinkedIn
● Subscribe to the Android Developer Newsletter

Tech Winter Break + GDG On Campus .pptx

  • 1.
    This work islicensed under the Apache 2.0 License ANDROID WORKSHOP
  • 2.
    This work islicensed under the Apache 2.0 License AKA imselmon 😎 Salman Shaikh Hey 👋 I’m Salman (Zain) Founder @ Scattr, Triplist
  • 3.
    This work islicensed under the Apache 2.0 License I do An Dr. Strange of Development Verse Web, Mobile, and Cloud Development
  • 4.
    This work islicensed under the Apache 2.0 License ● Basic computer literacy ● Basic math skills ● Computer & headphones ● Internet connection ● (Optional) Android device & USB cable Prerequisites
  • 5.
    This work islicensed under the Apache 2.0 License ● Build your first Android apps ● Set up Android Studio on your computer ● Learn the basics of the Kotlin programming language ● Learn Jetpack Compose ● Discover resources to continue learning Learning Objectives
  • 6.
    This work islicensed under the Apache 2.0 License 1. Why are you here? 2. What are you goals? 3. How do you plan to achieve them?
  • 7.
    This work islicensed under the Apache 2.0 License Who would like to share?
  • 8.
    This work islicensed under the Apache 2.0 License Android is an open-source operating system (OS) for mobile devices, such as smartphones, tablets, and smartwatches What is Android
  • 9.
    This work islicensed under the Apache 2.0 License TOPIC Presentation W H W H Say Cheesss Wrap up Today’s Schedule
  • 10.
    This work islicensed under the Apache 2.0 License Android Basics with Compose Course
  • 11.
    This work islicensed under the Apache 2.0 License Unit 1: Your first Android App
  • 12.
    This work islicensed under the Apache 2.0 License A Pathway
  • 13.
    This work islicensed under the Apache 2.0 License Take a Quiz
  • 14.
    This work islicensed under the Apache 2.0 License Earn badges!
  • 15.
    This work islicensed under the Apache 2.0 License Session Overview
  • 16.
    This work islicensed under the Apache 2.0 License Kotlin Programming Language Use Kotlin to start writing Android apps. Kotlin helps developers be more productive.
  • 17.
    This work islicensed under the Apache 2.0 License Kotlin Playground Write and run Kotlin code in the browser.
  • 18.
    This work islicensed under the Apache 2.0 License Program A series of instructions for a computer to perform some action. fun main() { println("Hello, world!") } Output: Hello, world!
  • 19.
    This work islicensed under the Apache 2.0 License Code Step by step instructions for what the computer should do. fun main() { println("Hello, world!") } Output: Hello, world!
  • 20.
    This work islicensed under the Apache 2.0 License main Function The main function is the entry point, or starting point, of the program. Start here fun main() { println("Hello, world!") } Output: Hello, world!
  • 21.
    This work islicensed under the Apache 2.0 License Functions A function is a segment of a program that performs a specific task. You can have many functions in your program or only a single one.
  • 22.
    This work islicensed under the Apache 2.0 License Defining a function Functions begin with the fun keyword. fun displayIntroduction() { }
  • 23.
    This work islicensed under the Apache 2.0 License Defining a function Functions have a name so that they can be called. fun displayIntroduction() { }
  • 24.
    This work islicensed under the Apache 2.0 License Defining a function Functions need a set of parentheses after the function name in order to surround the function inputs. fun displayIntroduction() { }
  • 25.
    This work islicensed under the Apache 2.0 License Defining a function The curly braces make up the function body and contain the instructions needed to execute a task. fun displayIntroduction() { }
  • 26.
    This work islicensed under the Apache 2.0 License Putting it together fun displayIntroduction() { // We will fill this out! } Output: Hi I’m Meghan and I am 28 years old
  • 27.
    This work islicensed under the Apache 2.0 License A container for a single piece of data. Variables
  • 28.
    This work islicensed under the Apache 2.0 License My name is and I am years old Variables name age
  • 29.
    This work islicensed under the Apache 2.0 License My name is and I am years old Variables Name value: Meghan Age value: 28 Output: My name is Meghan and I am 28 years old Name value: Janet Age value: 49 Output: My name is Janet and I am 49 years old name age
  • 30.
    This work islicensed under the Apache 2.0 License Basic data types Kotlin Data type What kind of data it can contain Example literal values String Text “Add contact” “Search” Int Whole integer number 32 -59873 Double Decimal number 2.0 -37123.9999 Float Decimal number (less precise than a Double). Has an f or F at the end of the number. 5.0f -1630.209f Boolean true or false. Use this data type when there are only two possible values. true false
  • 31.
    This work islicensed under the Apache 2.0 License val keyword Use when you expect the variable value will not change. Example: name var keyword Use when you expect the variable value can change. Example: age Defining a variable
  • 32.
    This work islicensed under the Apache 2.0 License Defining a variable Variables start with a var or val keyword. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }
  • 33.
    This work islicensed under the Apache 2.0 License Defining a variable All variables must have a name. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }
  • 34.
    This work islicensed under the Apache 2.0 License Defining a variable Data type is the type of data that the variable holds. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }
  • 35.
    This work islicensed under the Apache 2.0 License Defining a variable The initial value is the value that is stored in the variable. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }
  • 36.
    This work islicensed under the Apache 2.0 License Putting it together fun displayIntroduction() { val name = "Meghan" val age = 28 println("Hi I'm $name and I am $age years old") }
  • 37.
    This work islicensed under the Apache 2.0 License Putting it together fun main() { displayIntroduction() } fun displayIntroduction() { val name = "Meghan" val age = 28 println("Hi I'm $name and I am $age years old") } Output: Hi I’m Meghan and I am 28 years old
  • 38.
    This work islicensed under the Apache 2.0 License Break
  • 39.
    This work islicensed under the Apache 2.0 License Let’s get started
  • 40.
    This work islicensed under the Apache 2.0 License
  • 41.
    This work islicensed under the Apache 2.0 License Unit 1: Pathway 1
  • 42.
    This work islicensed under the Apache 2.0 License Work on Unit 1, Pathway 1 Have a Question? Just ask
  • 43.
    This work islicensed under the Apache 2.0 License Work on Unit 1, Pathway 1 Have a Question? Just ask
  • 44.
    This work islicensed under the Apache 2.0 License Welcome back And congrats!
  • 45.
    This work islicensed under the Apache 2.0 License What’s coming next:
  • 46.
    This work islicensed under the Apache 2.0 License Learn More
  • 47.
    This work islicensed under the Apache 2.0 License HYYYYYYYYYOOOOOO Optional resources to check out: ● Official Android Developers Site: developer.android.com ● Official Android Developers Blog (for announcements) ● Android Developers Medium Blog (for more technical articles) ● Android Developers YouTube channel ● Follow @AndroidDev on Twitter ● Follow @AndroidDev on LinkedIn ● Subscribe to the Android Developer Newsletter

Editor's Notes

  • #1 Welcome to Compose Camp Session 1! We are so excited to have you here starting your journey to becoming an Android Developer.
  • #2 The badges you earn can be saved to your Google Developer Profile. When you are taking the course, be sure to sign in (in the top right corner) and create a Google Developer Profile if you haven’t already. It’s very quick to create. As you earn more badges, you can see them on your Google Developer Profile and favorite them. You can make your profile public so you can share it and show off your badges to friends and colleagues via social media! [Read more on the Google Developer Profile]
  • #3 The badges you earn can be saved to your Google Developer Profile. When you are taking the course, be sure to sign in (in the top right corner) and create a Google Developer Profile if you haven’t already. It’s very quick to create. As you earn more badges, you can see them on your Google Developer Profile and favorite them. You can make your profile public so you can share it and show off your badges to friends and colleagues via social media! [Read more on the Google Developer Profile]
  • #4 Here are some the prerequisites that will be helpful. Having basic computer literacy and basic math skills is recommended. You’ll also need a computer and access to the internet to take the online course. [Mention WiFi instructions if necessary.]
  • #5 Let’s talk about what you will learn as part of this series of Compose Camp events. First and foremost, the goal is for you to build your first Android apps with Jetpack Compose. To do this, you will learn the Kotlin Programming Language and install Android Studio on your computer, which is an application to build Android apps. At the end, we’ll also talk about resources on how you can continue learning and building apps.
  • #6 Before we dive into the content, I want to get to know you better and what brought you here. Please take out a piece of paper. Take a moment to think about your answers to these questions and write them down. [Give 2-3 minutes to work and when most people have put down their pencils, proceed.]
  • #7 So what did everyone come up with? Who would like to share? [If there is a whiteboard or easel board, write down some answers. If not, simply discuss the answers that people give. After 1-2 people share for each question, continue...] Great, thank you for sharing! I encourage all of you to remember these answers throughout the session.
  • #8 In Compose Camp, you will learn how to build Android apps using Jetpack Compose, Android’s modern UI toolkit. Compose Camp is for everyone from absolute beginners through experienced developers. Through Compose Camp you will: Learn the latest Android Development Tools. Connect with other developers so that you can learn from each other and grow your network. Apply your new skills by creating apps that you can add to your personal portfolio of apps.
  • #9 Let’s look at the schedule for this session. [Please update this schedule accordingly before your event. For example, you can remove the practice problems if you would like a shorter session.] First, we have a short presentation covering some logistics and a high-level introduction to the concepts, to help you with the hands-on portion of the session later. Once I’m done talking, you’ll be able to dive into the course. You’ll be working independently in the first pathway of the course. This is just a suggested schedule. You can work through the pathway at your own pace and let me or any of the other facilitators know if you have questions. We’ll also have a short break in between. At the end of the session, I’ll bring everyone together and we can recap what we learned today and celebrate your progress!!
  • #10 You’ll be working through the Android Basics with Compose course. This is an online training course developed by Google for people who want to learn how to build basic Android apps.
  • #11 The course is made up of units, and units are composed of pathways. Today we’ll be focused on the first unit, which is shown here. It is made up of 3 pathways. In this session, you’ll work on pathway 1.
  • #12 You may be wondering, what is a pathway? A pathway is an ordered sequence of activities to learn a specific skill. An activity can be a video, hands-on coding tutorial (known as a codelab), an article, or quiz. There are 7 activities in this first pathway. All these activities are meant to help you reach specific learning objectives by the end of this pathway. If you are already familiar with the skill that the pathway teaches, you can skip that pathway and move on to the next one.
  • #13 There’s a quiz at the end of each pathway to check your understanding of what you just learned. Here’s what a sample quiz looks like. There are no limits to the number of retries for a quiz. But if you get a question wrong, try to understand what the concept is (even if you need to look back at the source material), before answering again.
  • #14 After you pass a quiz, you will earn a badge like these!
  • #15 Now that you’re familiar with the learning platform and how the course looks, let’s dive into some important concepts that you’ll be learning about.
  • #16 In this course, you’ll be learning how to create Android apps using Kotlin. Kotlin is a programming language which is recommended by Google for creating new Android apps. Kotlin is a modern and popular programming language, known for helping developers be more productive and more concise when writing code. As a result of many great language features, Kotlin has quickly gained momentum in industry and is used by over 50% of professional Android developers. Pathway 1 of the unit is focused on helping you understand the basics of Kotlin. [Read about Android’s Kotlin-first approach]
  • #17 To make it easier for you to learn, you’ll be writing your code in the Kotlin Playground which you can access via the web browser. The site looks something like this. You can write your code in this window and run it by hitting the green Run button. The result of your code (known as the output) will show up at the bottom of the window (where it says “Hello, world!”). To illustrate a few important concepts that you’ll learn in this pathway, we will go through a short code demo to create a program in Kotlin.
  • #18 In Kotlin Playground, you will learn to explore and modify simple programs in Kotlin. You can think of a program as a series of instructions for a computer or mobile device to perform some action. In this program, the action is printing “Hello, world!”.
  • #19 The step-by-step instructions for what the computer should do is called code. When you modify the code in a program, the output can change.
  • #20 A Kotlin program is required to have a main function, which is the entry point, or starting point, of the program. You may be asking what a function is…
  • #21 A function is a segment of a program that performs a specific task. You can have many functions in your program or only a single one. Creating separate functions for specific tasks has a number of benefits. Reusable code: Rather than copying and pasting code that you need to use more than once, you can simply call a function wherever needed. Readability: Ensuring functions do one and only one specific task helps other developers and teammates, as well as your future self to know exactly what a piece of code does.
  • #22 We will demonstrate how to define a function with a function called displayIntroduction() that we will use to print our name and age. A function definition starts with the fun keyword. A keyword is a reserved word that has a special meaning in Kotlin, in this case the fun keyword tells Kotlin that you are going to make a function.
  • #23 Functions need to have a descriptive name so that they can be called from other parts of the program.
  • #24 Functions need a set of parentheses which you can use to optionally pass information into the function. displayIntroduction() won’t need information passed in. You will learn more about passing in inputs into functions later in the course.
  • #25 Functions need curly braces that contain the instructions needed to execute a task.
  • #26 The task of the displayIntroduction() function, is to print your name and age. In order to do that you will save both your name and age into variables.
  • #27 In computer programming, a variable is a container for a single piece of data. You can envision it as a box that contains a value. The box has a label, which is the name of the variable. By referring to the box by its name, you have access to the value it holds.
  • #28 You may be thinking, why store your name and age in variables when you can use them directly? The problem is that when your code uses values directly in all the instructions, your program will only work for that specific case. In this example, there are boxes in the sentence that contain values for both name and age.
  • #29 If you change the values of the variables the output will change. In the first example, the value of the name variable is “Meghan” and the value of the age variable is 28. The corresponding output prints “My name is Meghan and I am 28 years old”. In the second example, the value of the name variable is “Janet” and the value of the age variable is 49. The corresponding output prints “My name is Janet and I am 49 years old”.
  • #30 When you decide what aspects of your app can be variables, it's important to specify what type of data can be stored in those variables. In Kotlin, there are some common basic data types. This table shows a different data type in each row. For each data type, there's a description of what kind of data it can hold and example values. A String holds text so you will use it to store your name, and an Int holds an integer number so you will use it to store your age.
  • #31 Now, let’s jump into how you define a variable. You can declare a variable using either val or var. With val, the variable is read-only, which means you can only read, or access, the value of the variable. Once the value is set, you cannot edit or modify its value. With var, the variable is mutable, which means the value can be changed or modified. The value can be mutated. In Kotlin, it's preferred to use val over var when possible. We will store your name as a val because that will not change. We will store your age as a var because it changes every year.
  • #32 To demonstrate how to define a variable we will define both name and age variables. Before you use a variable, you must declare it. To declare a variable, start with the val or var keyword.
  • #33 All variables must have a name that they can be referenced by.
  • #34 The data type specifies the type of data that the variable holds. Note that a colon separates the name and data type.
  • #35 In the variable declaration, the equal sign symbol (=) follows the data type. The equal sign symbol is called the assignment operator. The assignment operator assigns a value to the variable. The variable’s initial value is the data stored in the variable.
  • #36 Let’s finish putting the displayIntroduction() function together. We have our variables but they don’t do anything yet. Let’s add a print statement to print out your introduction using println to print to the output in Kotlin Playground. In order to print your variables, you will use String templates which allow you to include variable references in a string by using the $ sign before the variable name. [You can learn more about String Templates here]
  • #37 Finally, we will replace the contents of the main() function with a call to the displayIntroduction() function when we run it, “Hi I’m Meghan and I am 28 years old” will print to the output. In this lecture we went over functions and variables and how to put them together to create a function that introduces you. Soon you will go deeper into these concepts and try them out for yourself in the codelabs.
  • #39 Okay that’s it! In a moment, I’ll let you get started on the course. Work at your own pace. If you get stuck, you can ask me or the other facilitators who will be available. [Introduce facilitators if applicable.] We’re here to answer whatever questions you have. Also feel free to ask each other for help and work together to find solutions.
  • #40 Then, click Unit 1 to start the Android Basics course.
  • #41 Feel free to get started working on pathway 1 independently and don’t hesitate to ask if you have questions.
  • #42 [You can give them about 2 hours to work on this, with another break as needed.]
  • #43 [You can give them about 2 hours to work on this, with another break as needed.]
  • #44 Alright everyone welcome back! How was it? Does anyone want to share what you learned today?
  • #45 In the next session, you will apply your new Kotlin knowledge to build your first Android app!
  • #46 If you want to continue learning more on your own, here are some resources.
  • #47 We are excited to see you at the next Compose Camp session! Before the next session, it is strongly recommended that you download Android Studio. In the meantime you can check out these additional resources, which professional developers use to stay up to date on Android. As you get into more advanced features, you will likely need to learn more programming concepts. You can check out the Learn Kotlin By Example or the Kotlin language website resources for that. Thank you so much for being a part of Compose Camp! Good luck on the beginning of your Android developer journey!