Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Compose Camp Day 1.pdf
1. This work is licensed under the Apache 2.0 License
Compose Camp
Android Basics with Compose:
Unit 1 Pathway 1
2. This work is licensed under the Apache 2.0 License
Compose Camp is a hands-on introduction to
learning how you can build Android apps with
Jetpack Compose.
What is Compose Camp?
3. 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
4. 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
5. 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?
6. This work is licensed under the Apache 2.0 License
TOPIC TIME
Presentation 4:00 - 4:15
Your first program in
Kotlin
4:15 - 4:30
Create and use variables
in Kotlin
4:30 - 4:50
Break 4:50 - 5:00
Create and use
functions in Kotlin
5:00 - 5:30
Practice problems 5:30 - 5:45
Wrap up 5:45 - 6:00
Day 1 Schedule
7. This work is licensed under the Apache 2.0 License
Android Basics
with Compose Course
8. This work is licensed under the Apache 2.0 License
Unit 1: Your first
Android App
9. This work is licensed under the Apache 2.0 License
A Pathway
10. This work is licensed under the Apache 2.0 License
Take a Quiz
11. This work is licensed under the Apache 2.0 License
Earn badges!
12. This work is licensed under the Apache 2.0 License
Google Developer
Profile
Carrie Sawyer
13. This work is licensed under the Apache 2.0 License
Session Overview
14. 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.
15. This work is licensed under the Apache 2.0 License
Kotlin Playground
Write and run Kotlin code in
the browser.
16. 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!
17. 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!
18. 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!
19. 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.
20. This work is licensed under the Apache 2.0 License
Defining a function
Functions begin with the fun
keyword.
fun displayIntroduction() {
}
21. 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() {
}
22. 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() {
}
23. 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() {
}
24. 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
25. This work is licensed under the Apache 2.0 License
A container for a single piece of data.
Variables
26. This work is licensed under the Apache 2.0 License
My name is and I am years old
Variables
name age
27. 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
28. 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
29. 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
30. 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
}
31. 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
}
32. 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
}
33. 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
}
34. 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")
}
35. 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
36. This work is licensed under the Apache 2.0 License
Let’s get started
37. This work is licensed under the Apache 2.0 License
g.co/android/basics-compose
Start here:
38. This work is licensed under the Apache 2.0 License
39. This work is licensed under the Apache 2.0 License
Unit 1: Pathway 1
40. This work is licensed under the Apache 2.0 License
Work on Unit 1, Pathway 1
Have a Question?
Just ask
41. This work is licensed under the Apache 2.0 License
Break
42. This work is licensed under the Apache 2.0 License
Work on Unit 1, Pathway 1
Have a Question?
Just ask
43. This work is licensed under the Apache 2.0 License
Welcome back
And congrats!
44. This work is licensed under the Apache 2.0 License
What’s coming next:
45. 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
46. This work is licensed under the Apache 2.0 License
Learn More
47. 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