This document outlines an introduction to Kotlin and Jetpack Compose event called Compose Camp. It provides an overview of what Compose Camp is, which is a community-organized event to teach attendees hands-on coding skills using Jetpack Compose. The document outlines the learning objectives, such as building first Android apps, setting up Android Studio, learning Kotlin and Compose. It also provides information on resources for continuing learning Compose after the event.
This Android development workshop is a gateway to the exciting world of mobile app development. Whether you're a complete beginner or have some programming expertise, this class will provide you with the core skills and knowledge required to create great Android apps.
This Android development workshop is a gateway to the exciting world of mobile app development. Whether you're a complete beginner or have some programming expertise, this class will provide you with the core skills and knowledge required to create great Android apps.
Android Study Jams - New to Programming [27th december]PragatiVerma31
Hey Droids!
We are coming up with our next session of Android Study Jams.
Join us on ️ December 27, 2020, 4 PM - 6 PM
What are Android Study Jams?
Android Study Jams are community-organized study groups for students and professionals to learn how to build Android apps in the Kotlin programming language, using a curriculum provided by Google.
Know more about it here: https://g.co/android/studyjams
There are two tracks available:
Track 1: New to Programming Track - For people who are new to programming, follows the Android Basics in Kotlin course.
Track 2: Prior Programming Track - For people who already have programming experience, follows the Android Kotlin Fundamental course. Also includes a pre-work section using Kotlin Koans from JetBrains for those who are new to Kotlin.
During the course, you will get a general overview of mobile development for Android, learn basic programming concepts as well as core vocabulary and concepts in Android, get hands-on experience building a small app using the Kotlin language, and understand what opportunities exist for you in the vibrant Berlin tech scene as an Android programmer.
Note : This session will be appropriate for anyone interested in learning more about the field and prior programming knowledge will not be necessary.
Our speakers will tell you in detail how you can learn android in kotlin and after that each unit has badges earn the 10 badges and get a certificate direct from Google.
Android Study Jam for DSC JSS will be conducted by Dheeraj Kotwani, our Android Study Jam Facilitator. Reach out to him on the following links:
Instagram: https://www.instagram.com/dheeraj_kotwani/
GitHub: https://github.com/dheerajkotwani
Twitter: https://twitter.com/kotwani_dheeraj
LinkedIn: https://www.linkedin.com/in/dheerajkotwani/
Also, join us on discord to stay updated and seek guidance from the best in the arena of android development.
Discord Link: https://bit.ly/DSCJSSATEN-DISCORD
Android Study Jams - New to Programming [27th december]PragatiVerma31
Hey Droids!
We are coming up with our next session of Android Study Jams.
Join us on ️ December 27, 2020, 4 PM - 6 PM
What are Android Study Jams?
Android Study Jams are community-organized study groups for students and professionals to learn how to build Android apps in the Kotlin programming language, using a curriculum provided by Google.
Know more about it here: https://g.co/android/studyjams
There are two tracks available:
Track 1: New to Programming Track - For people who are new to programming, follows the Android Basics in Kotlin course.
Track 2: Prior Programming Track - For people who already have programming experience, follows the Android Kotlin Fundamental course. Also includes a pre-work section using Kotlin Koans from JetBrains for those who are new to Kotlin.
During the course, you will get a general overview of mobile development for Android, learn basic programming concepts as well as core vocabulary and concepts in Android, get hands-on experience building a small app using the Kotlin language, and understand what opportunities exist for you in the vibrant Berlin tech scene as an Android programmer.
Note : This session will be appropriate for anyone interested in learning more about the field and prior programming knowledge will not be necessary.
Our speakers will tell you in detail how you can learn android in kotlin and after that each unit has badges earn the 10 badges and get a certificate direct from Google.
Android Study Jam for DSC JSS will be conducted by Dheeraj Kotwani, our Android Study Jam Facilitator. Reach out to him on the following links:
Instagram: https://www.instagram.com/dheeraj_kotwani/
GitHub: https://github.com/dheerajkotwani
Twitter: https://twitter.com/kotwani_dheeraj
LinkedIn: https://www.linkedin.com/in/dheerajkotwani/
Also, join us on discord to stay updated and seek guidance from the best in the arena of android development.
Discord Link: https://bit.ly/DSCJSSATEN-DISCORD
2. This work is licensed under the Apache 2.0 License
Compose Camp
30th September 2022
Introduction to Kotlin
& Jetpack compose
3. This work is licensed under the Apache 2.0 License
Parshant Yadav
Android Facilitator
Camp leaders
4. This work is licensed under the Apache 2.0 License
What is Compose Camp?
Community-organized events focused around
how to build Android apps using Jetpack
Compose, where attendees get hands-on
coding experience with Compose.
5. This work is licensed under the Apache 2.0 License
Jetpack Compose is the
modern toolkit for building
native user interfaces for
Android apps.
Compose makes it easier and
faster to build UIs on Android.
6. This work is licensed under the Apache 2.0 License
Is Compose Camp similar
to Android Study Jams?
Yes! If you’re familiar with Android Study Jams, the learning format is the same. It’s a group of
people coming together to do hands-on learning for a specific Android topic, like a study
group.
The difference is that with Compose Camp, the focus is on specifically learning Compose skills
for Android, with a fun camp theme!
As with Android Study Jams, there are plenty of materials and curriculum in the Compose
Camp content bundle to help you prep for hosting these events and tailoring them to the
needs of your audience.
7. 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
8. 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
Compose Camp Learning Objectives
9. This work is licensed under the Apache 2.0 License
Android Studio
10. This work is licensed under the Apache 2.0 License
Android Studio
11. This work is licensed under the Apache 2.0 License
Android Studio - Project View
12. This work is licensed under the Apache 2.0 License
Android Studio - Code View
13. This work is licensed under the Apache 2.0 License
Android Studio - Code View
14. This work is licensed under the Apache 2.0 License
Android Studio - Design View
15. This work is licensed under the Apache 2.0 License
Android Studio - Design View
16. This work is licensed under the Apache 2.0 License
Android Studio - Split View
17. This work is licensed under the Apache 2.0 License
Android Studio - Greeting function
18. This work is licensed under the Apache 2.0 License
The Android Emulator emulates Android devices on your computer
so that you can test your application on a variety of devices and
Android API levels without needing to have each physical device.
What is an emulator?
19. This work is licensed under the Apache 2.0 License
Creating an emulator
20. This work is licensed under the Apache 2.0 License
Creating an emulator
21. This work is licensed under the Apache 2.0 License
Favorite Color App
22. This work is licensed under the Apache 2.0 License
Running your app on
a physical device
23. This work is licensed under the Apache 2.0 License
Compose apps are written in
the Kotlin programming
language.
Kotlin is the language that the
majority of professional Android
developers use to build apps.
24. This work is licensed under the Apache 2.0 License
Kotlin Playground
Write and run Kotlin code in
the browser.
25. 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!
26. 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!
27. 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!
28. 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.
29. This work is licensed under the Apache 2.0 License
Defining a function
Functions begin with the fun
keyword.
fun displayIntroduction() {
}
30. 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() {
}
31. 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() {
}
32. 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() {
}
33. 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
34. This work is licensed under the Apache 2.0 License
A container for a single piece of
data.
Variables
35. This work is licensed under the Apache 2.0 License
My name is and I am years old
Variables
name age
36. 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
37. 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
38. 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
39. 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
}
40. 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
}
41. 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
}
42. 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
}
43. 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")
}
44. 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
45. This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Howdy $name!")
}
46. This work is licensed under the Apache 2.0 License
What’s coming next:
51. This work is licensed under the Apache 2.0 License
Share what you’ve
learned using
.#ComposeCamp
on social media
For a chance to be
featured by Android,
submit your tips on
learning Compose to
goo.gle/compose-tips
52. This work is licensed under the Apache 2.0 License
Let’s talk about
Resources
53. This work is licensed under the Apache 2.0 License
g.co/android/basics-compose
Start here:
54. This work is licensed under the Apache 2.0 License
Android Basics
with Compose Course
55. This work is licensed under the Apache 2.0 License
56. This work is licensed under the Apache 2.0 License
Unit 1: Your first
Android App
57. This work is licensed under the Apache 2.0 License
A Pathway
58. This work is licensed under the Apache 2.0 License
Take a Quiz
59. This work is licensed under the Apache 2.0 License
Earn badges!
60. This work is licensed under the Apache 2.0 License
Google Developer
Profile
Carrie Sawyer
61. This work is licensed under the Apache 2.0 License
See you at the next Compose Camp Session!
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
● Kotlin 101 course
62. This work is licensed under the Apache 2.0 License
Learn More
63. This work is licensed under the Apache 2.0 License
Share what you’ve
learned using
.#ComposeCamp
on social media
For a chance to be
featured by Android,
submit your tips on
learning Compose to
goo.gle/compose-tips
64. This work is licensed under the Apache 2.0 License
THANK YOU
for participating Compose Camp Day 1
Do participate tomorrow as well
Editor's Notes
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.]
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.
Android Studio is the official integrated development environment (IDE) for Android app development built and distributed by Google. An IDE contains tools that make it easy for software developers to design, build, run, and test software, in this case, apps for the Android platform.
[If students have already downloaded Android Studio, skip the text below.]
You will be downloading Android Studio in today’s session. Note that you will need to verify that your computer meets the Android Studio system requirements. If your computer doesn’t meet the requirements Android Studio may not run or may run suboptimally. Android Studio may also take a while to install.
[Android Studio can be downloaded here]
This is what Android Studio looks like: let’s talk about the different components of it.
The Project view displays the files and folders of our project.
The Code view is where we will view and edit code.
To see the Design tab, we click Design at the top right of the window.
The Design tab is where we can preview what our app looks like. Currently, the Design tab shows the default app that displays the text “Hello Android!”.
To see the Split view, we click Split at the top right of the window.
This is the Split view where you can see both the Code and Design tabs. You’ll be working in split view during Compose Camp. This is helpful because you are able to see how your code updates are reflected in the apps UI.
In the code view, let’s take a look at the Greeting() function.
The Android Emulator emulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.
The emulator is a great option to be familiar with even if you do have a physical device because it allows you to simulate your app on a variety of mobile devices without having to own any of them. The emulator allows you to test on multiple devices to make sure that your app runs as expected on different phones, sizes, API levels and more.
You can create your own emulator in Android Studio using the Device Manager. As you can see, you are able to choose from a variety of devices.
You can also choose from a variety API levels.
When the emulator runs you will see this in Android Studio. The device shows the text “Howdy Meghan!”
[Ideally demoing running an app on a physical device will be better than showing this video as the students will be able to see it come together in real time. It could be fun to change the colors and rerun so that they see the changes.]
You can also run an app on your physical device. You will be trying it out yourself in the session.
Connect your Android device to your computer with a USB cable.
This dialog should appear on your device, which asks you to allow USB debugging. Select the Always allow from this computer checkbox and then tap OK.
In Android Studio on your computer, make sure your device is selected in the dropdown. Click the Run button.
Android Studio installs the app on your device and runs it.
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.
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!”.
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.
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…
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.
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.
Functions need to have a descriptive name so that they can be called from other parts of the program.
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.
Functions need curly braces that contain the instructions needed to execute a task.
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.
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.
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.
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”.
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.
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.
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.
All variables must have a name that they can be referenced by.
The data type specifies the type of data that the variable holds. Note that a colon separates the name and data type.
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.
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]
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.
When we rebuild, we will see the text “Howdy Android” instead of “Hello Android” in the Design tab.
In the next session, you will apply your new Kotlin knowledge to build your first Android app!
Great job everyone on your progress!
You can post photos or highlights from today’s session on social media using #ComposeCamp. [Include your own developer community and chapter hashtags (i.e. #developerstudentclubs #dsccmu)]
Submit any tips you have about learning Compose to goo.gle/compose-tips for a chance to be featured.
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.
Open the course page with the link on screen.
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.
Then, click Unit 1 to start the Android Basics course.
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.
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.
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.
After you pass a quiz, you will earn a badge like these!
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]
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!
If you want to continue learning more on your own, here are some resources.
Great job everyone on your progress!
You can post photos or highlights from today’s session on social media using #ComposeCamp. [Include your own developer community and chapter hashtags (i.e. #developerstudentclubs #dsccmu)]
Submit any tips you have about learning Compose to goo.gle/compose-tips for a chance to be featured.