SlideShare a Scribd company logo
1 of 109
This work is licensed under the Apache 2.0 License
Compose Camp - Day 1
Lokesh Vazirani
AOSP Contributor & Android Lead GDSC
GHRCE
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?
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
Compose Camp Learning Objectives
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
Google Developer
Profile
Carrie Sawyer
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
Let’s get started
This work is licensed under the Apache 2.0 License
g.co/android/basics-compose
Start here:
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
See You Tomorrow
This work is licensed under the Apache 2.0 License
Compose Camp - Day 2
Lokesh Vazirani
AOSP Contributor & Android Lead GDSC
GHRCE
This work is licensed under the Apache 2.0 License
Welcome back
Any questions?
This work is licensed under the Apache 2.0 License
Android Studio
This work is licensed under the Apache 2.0 License
Android Studio
This work is licensed under the Apache 2.0 License
Android Studio - Project View
This work is licensed under the Apache 2.0 License
Android Studio - Code View
This work is licensed under the Apache 2.0 License
Android Studio - Code View
This work is licensed under the Apache 2.0 License
Android Studio - Design View
This work is licensed under the Apache 2.0 License
Android Studio - Design View
This work is licensed under the Apache 2.0 License
Android Studio - Split View
This work is licensed under the Apache 2.0 License
Android Studio - Greeting function
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Howdy $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Howdy $name!")
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
FirstComposeProjectTheme {
Greeting("Android")
}
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
FirstComposeProjectTheme {
Greeting("Meghan")
}
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Howdy $name!")
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
FirstComposeProjectTheme {
Greeting("Meghan")
}
}
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?
This work is licensed under the Apache 2.0 License
Creating an emulator
This work is licensed under the Apache 2.0 License
Creating an emulator
This work is licensed under the Apache 2.0 License
Favorite Color App
This work is licensed under the Apache 2.0 License
Running your app on
a physical device
This work is licensed under the Apache 2.0 License
Let’s get started
Let’s get started
This work is licensed under the Apache 2.0 License
g.co/android/basics-compose
Start here:
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Unit 1: Pathway 2
This work is licensed under the Apache 2.0 License
Have a Question? Just ask
Work on Unit 1, Pathway 2
This work is licensed under the Apache 2.0 License
See You Tomorrow
This work is licensed under the Apache 2.0 License
Compose Camp - Day 3
Lokesh Vazirani
AOSP Contributor & Android Lead GDSC
GHRCE
This work is licensed under the Apache 2.0 License
Welcome back
Any questions?
This work is licensed under the Apache 2.0 License
Jetpack Compose
This work is licensed under the Apache 2.0 License
A composable function
● Describes some part of your UI.
● Doesn't return anything.
● Takes some input and generates what's shown on the screen.
● Might emit several UI elements.
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Greeting()
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
This work is licensed under the Apache 2.0 License
Pet Adoption App
This work is licensed under the Apache 2.0 License
PetName()
@Composable
fun PetName() {
}
This work is licensed under the Apache 2.0 License
PetName()
@Composable
fun PetName() {
Text()
}
This work is licensed under the Apache 2.0 License
PetName()
@Composable
fun PetName() {
Text(text = "Bark! My name is Koda.")
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
PetAdoptionTheme {
PetName()
}
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
This work is licensed under the Apache 2.0 License
PetInformation()
@Composable
fun PetInformation() {
Text(text = "I'm three years old and I like to bark.")
}
This work is licensed under the Apache 2.0 License
Column and Row
Column
Row
This work is licensed under the Apache 2.0 License
DefaultPreview()
This work is licensed under the Apache 2.0 License
PetAdoptionColumn()
@Composable
fun PetAdoptionInformation() {
Column {
}
}
This work is licensed under the Apache 2.0 License
PetAdoptionColumn()
@Composable
fun PetAdoptionInformation() {
Column {
PetName()
PetInformation()
}
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
PetAdoptionTheme {
PetAdoptionInformation()
}
}
This work is licensed under the Apache 2.0 License
DefaultPreview()
This work is licensed under the Apache 2.0 License
Resources()
This work is licensed under the Apache 2.0 License
Accessing Resources
R.drawable.koda
This work is licensed under the Apache 2.0 License
Accessing Resources
R.drawable.koda
This work is licensed under the Apache 2.0 License
Accessing Resources
R.drawable.koda
This work is licensed under the Apache 2.0 License
Accessing Resources
R.drawable.koda
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image =
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image = painterResource(...)
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image = painterResource(id = R.drawable.koda)
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image = painterResource(id = R.drawable.koda)
Image(painter = ,
contentDescription = )
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image = painterResource(id = R.drawable.koda)
Image(painter = image,
contentDescription = )
}
This work is licensed under the Apache 2.0 License
PetImage()
@Composable
fun PetImage() {
val image = painterResource(id = R.drawable.koda)
Image(painter = image,
contentDescription = "Gray and white dog with a
collar sitting on a bed")
}
This work is licensed under the Apache 2.0 License
PetAdoptionInformation()
@Composable
fun PetAdoptionInformation() {
Column {
PetImage()
PetName()
PetInformation()
}
}
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Let’s get started
Let’s get started
This work is licensed under the Apache 2.0 License
g.co/android/basics-compose
Start here:
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Unit 1: Pathway 3
This work is licensed under the Apache 2.0 License
Have a Question? Just ask
Work on Unit 1, Pathway 3
This work is licensed under the Apache 2.0 License
Good Luck For
Your Solutions

More Related Content

Similar to Google Solution Challenge Android Awesomeness.pptx

Compose Camp S1.pptx
Compose Camp S1.pptxCompose Camp S1.pptx
Compose Camp S1.pptxGDSCSIT
 
Session-1 edited.pptx
Session-1 edited.pptxSession-1 edited.pptx
Session-1 edited.pptxscienceTech11
 
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdf
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdfAndroid Development | Compose camp day 3 | GDSC SEC Sasaram.pdf
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdfShivamShrey1
 
Compose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptxCompose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptxIshwariKulkarni6
 
Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]PragatiVerma31
 
Android study jam iiitv kick-off sesson
Android study jam iiitv   kick-off sessonAndroid study jam iiitv   kick-off sesson
Android study jam iiitv kick-off sessonAshutoshSingh1124
 
-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptx-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptxRishiGandhi19
 
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptxshahipc
 
Android study jams
Android study jamsAndroid study jams
Android study jamsNaveenK158
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience trackAshwinRaj57
 
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...Svetlin Stanchev
 
GDSC_day_1.pptx
GDSC_day_1.pptxGDSC_day_1.pptx
GDSC_day_1.pptxGDSCICOER
 

Similar to Google Solution Challenge Android Awesomeness.pptx (20)

Compose Camp 2.pdf
Compose Camp 2.pdfCompose Camp 2.pdf
Compose Camp 2.pdf
 
Compose Camp.pdf
Compose Camp.pdfCompose Camp.pdf
Compose Camp.pdf
 
Compose Camp S1.pptx
Compose Camp S1.pptxCompose Camp S1.pptx
Compose Camp S1.pptx
 
Session-1 edited.pptx
Session-1 edited.pptxSession-1 edited.pptx
Session-1 edited.pptx
 
Session-1.pptx
Session-1.pptxSession-1.pptx
Session-1.pptx
 
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdf
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdfAndroid Development | Compose camp day 3 | GDSC SEC Sasaram.pdf
Android Development | Compose camp day 3 | GDSC SEC Sasaram.pdf
 
Compose #1.pptx
Compose #1.pptxCompose #1.pptx
Compose #1.pptx
 
Compose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptxCompose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptx
 
Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]
 
Android study jam iiitv kick-off sesson
Android study jam iiitv   kick-off sessonAndroid study jam iiitv   kick-off sesson
Android study jam iiitv kick-off sesson
 
Compose Camp
Compose Camp Compose Camp
Compose Camp
 
-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptx-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptx
 
-Kotlin Camp Unit2.pptx
-Kotlin Camp Unit2.pptx-Kotlin Camp Unit2.pptx
-Kotlin Camp Unit2.pptx
 
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx
[EXTERNAL] Android Basics Sessions 1 _ 2 - Android Study Jams.pptx
 
Android study jams
Android study jamsAndroid study jams
Android study jams
 
Compose Camp Session 1.pdf
Compose Camp Session 1.pdfCompose Camp Session 1.pdf
Compose Camp Session 1.pdf
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience track
 
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...
Compose Camp - Jetpack Compose for Android Developers _ Introduction Session ...
 
GDSC_day_1.pptx
GDSC_day_1.pptxGDSC_day_1.pptx
GDSC_day_1.pptx
 
Jetpack Compose Recap Session.pdf
Jetpack Compose Recap Session.pdfJetpack Compose Recap Session.pdf
Jetpack Compose Recap Session.pdf
 

More from GoogleDeveloperStude22

GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptxGoogleDeveloperStude22
 
Info to Web3 and Blockchain with GDSC X Capx.pptx
Info to Web3 and Blockchain with GDSC X Capx.pptxInfo to Web3 and Blockchain with GDSC X Capx.pptx
Info to Web3 and Blockchain with GDSC X Capx.pptxGoogleDeveloperStude22
 
Solution challenge 2024 GDSC-GHRCE AIML.pptx
Solution challenge 2024 GDSC-GHRCE AIML.pptxSolution challenge 2024 GDSC-GHRCE AIML.pptx
Solution challenge 2024 GDSC-GHRCE AIML.pptxGoogleDeveloperStude22
 
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdf
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdfSolution Challenge GDSC GHRCE WEB DEVELOPMENT.pdf
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdfGoogleDeveloperStude22
 
solution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxsolution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxGoogleDeveloperStude22
 
Green flag Wrap up Google Solution Challenge.pdf
Green flag Wrap up Google Solution Challenge.pdfGreen flag Wrap up Google Solution Challenge.pdf
Green flag Wrap up Google Solution Challenge.pdfGoogleDeveloperStude22
 

More from GoogleDeveloperStude22 (8)

GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptx
 
Info to Web3 and Blockchain with GDSC X Capx.pptx
Info to Web3 and Blockchain with GDSC X Capx.pptxInfo to Web3 and Blockchain with GDSC X Capx.pptx
Info to Web3 and Blockchain with GDSC X Capx.pptx
 
Solution challenge 2024 GDSC-GHRCE AIML.pptx
Solution challenge 2024 GDSC-GHRCE AIML.pptxSolution challenge 2024 GDSC-GHRCE AIML.pptx
Solution challenge 2024 GDSC-GHRCE AIML.pptx
 
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdf
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdfSolution Challenge GDSC GHRCE WEB DEVELOPMENT.pdf
Solution Challenge GDSC GHRCE WEB DEVELOPMENT.pdf
 
solution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxsolution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptx
 
Green flag Wrap up Google Solution Challenge.pdf
Green flag Wrap up Google Solution Challenge.pdfGreen flag Wrap up Google Solution Challenge.pdf
Green flag Wrap up Google Solution Challenge.pdf
 
Figma Lifestyle with GDSC
Figma Lifestyle with GDSCFigma Lifestyle with GDSC
Figma Lifestyle with GDSC
 
GDSC23 - (24-8-23).pptx
GDSC23 - (24-8-23).pptxGDSC23 - (24-8-23).pptx
GDSC23 - (24-8-23).pptx
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Google Solution Challenge Android Awesomeness.pptx

  • 1. This work is licensed under the Apache 2.0 License Compose Camp - Day 1 Lokesh Vazirani AOSP Contributor & Android Lead GDSC GHRCE
  • 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 Android Basics with Compose Course
  • 6. This work is licensed under the Apache 2.0 License Unit 1: Your first Android App
  • 7. This work is licensed under the Apache 2.0 License A Pathway
  • 8. This work is licensed under the Apache 2.0 License Take a Quiz
  • 9. This work is licensed under the Apache 2.0 License Earn badges!
  • 10. This work is licensed under the Apache 2.0 License Google Developer Profile Carrie Sawyer
  • 11. This work is licensed under the Apache 2.0 License Session Overview
  • 12. 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.
  • 13. This work is licensed under the Apache 2.0 License Kotlin Playground Write and run Kotlin code in the browser.
  • 14. 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!
  • 15. 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!
  • 16. 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!
  • 17. 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.
  • 18. This work is licensed under the Apache 2.0 License Defining a function Functions begin with the fun keyword. fun displayIntroduction() { }
  • 19. 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() { }
  • 20. 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() { }
  • 21. 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() { }
  • 22. 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
  • 23. This work is licensed under the Apache 2.0 License A container for a single piece of data. Variables
  • 24. This work is licensed under the Apache 2.0 License My name is and I am years old Variables name age
  • 25. 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
  • 26. 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
  • 27. 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
  • 28. 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 }
  • 29. 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 }
  • 30. 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 }
  • 31. 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 }
  • 32. 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") }
  • 33. 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
  • 34. This work is licensed under the Apache 2.0 License Let’s get started
  • 35. This work is licensed under the Apache 2.0 License g.co/android/basics-compose Start here:
  • 36. This work is licensed under the Apache 2.0 License
  • 37. This work is licensed under the Apache 2.0 License Unit 1: Pathway 1
  • 38. This work is licensed under the Apache 2.0 License See You Tomorrow
  • 39. This work is licensed under the Apache 2.0 License Compose Camp - Day 2 Lokesh Vazirani AOSP Contributor & Android Lead GDSC GHRCE
  • 40. This work is licensed under the Apache 2.0 License Welcome back Any questions?
  • 41. This work is licensed under the Apache 2.0 License Android Studio
  • 42. This work is licensed under the Apache 2.0 License Android Studio
  • 43. This work is licensed under the Apache 2.0 License Android Studio - Project View
  • 44. This work is licensed under the Apache 2.0 License Android Studio - Code View
  • 45. This work is licensed under the Apache 2.0 License Android Studio - Code View
  • 46. This work is licensed under the Apache 2.0 License Android Studio - Design View
  • 47. This work is licensed under the Apache 2.0 License Android Studio - Design View
  • 48. This work is licensed under the Apache 2.0 License Android Studio - Split View
  • 49. This work is licensed under the Apache 2.0 License Android Studio - Greeting function
  • 50. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 51. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Howdy $name!") }
  • 52. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Howdy $name!") }
  • 53. This work is licensed under the Apache 2.0 License DefaultPreview() @Preview(showBackground = true) @Composable fun DefaultPreview() { FirstComposeProjectTheme { Greeting("Android") } }
  • 54. This work is licensed under the Apache 2.0 License DefaultPreview() @Preview(showBackground = true) @Composable fun DefaultPreview() { FirstComposeProjectTheme { Greeting("Meghan") } }
  • 55. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Howdy $name!") } @Preview(showBackground = true) @Composable fun DefaultPreview() { FirstComposeProjectTheme { Greeting("Meghan") } }
  • 56. 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?
  • 57. This work is licensed under the Apache 2.0 License Creating an emulator
  • 58. This work is licensed under the Apache 2.0 License Creating an emulator
  • 59. This work is licensed under the Apache 2.0 License Favorite Color App
  • 60. This work is licensed under the Apache 2.0 License Running your app on a physical device
  • 61. This work is licensed under the Apache 2.0 License Let’s get started Let’s get started
  • 62. This work is licensed under the Apache 2.0 License g.co/android/basics-compose Start here:
  • 63. This work is licensed under the Apache 2.0 License
  • 64. This work is licensed under the Apache 2.0 License Unit 1: Pathway 2
  • 65. This work is licensed under the Apache 2.0 License Have a Question? Just ask Work on Unit 1, Pathway 2
  • 66. This work is licensed under the Apache 2.0 License See You Tomorrow
  • 67. This work is licensed under the Apache 2.0 License Compose Camp - Day 3 Lokesh Vazirani AOSP Contributor & Android Lead GDSC GHRCE
  • 68. This work is licensed under the Apache 2.0 License Welcome back Any questions?
  • 69. This work is licensed under the Apache 2.0 License Jetpack Compose
  • 70. This work is licensed under the Apache 2.0 License A composable function ● Describes some part of your UI. ● Doesn't return anything. ● Takes some input and generates what's shown on the screen. ● Might emit several UI elements.
  • 71. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 72. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 73. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 74. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 75. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 76. This work is licensed under the Apache 2.0 License Greeting() @Composable fun Greeting(name: String) { Text(text = "Hello $name!") }
  • 77. This work is licensed under the Apache 2.0 License Pet Adoption App
  • 78. This work is licensed under the Apache 2.0 License PetName() @Composable fun PetName() { }
  • 79. This work is licensed under the Apache 2.0 License PetName() @Composable fun PetName() { Text() }
  • 80. This work is licensed under the Apache 2.0 License PetName() @Composable fun PetName() { Text(text = "Bark! My name is Koda.") }
  • 81. This work is licensed under the Apache 2.0 License DefaultPreview() @Preview(showBackground = true) @Composable fun DefaultPreview() { PetAdoptionTheme { PetName() } }
  • 82. This work is licensed under the Apache 2.0 License DefaultPreview()
  • 83. This work is licensed under the Apache 2.0 License PetInformation() @Composable fun PetInformation() { Text(text = "I'm three years old and I like to bark.") }
  • 84. This work is licensed under the Apache 2.0 License Column and Row Column Row
  • 85. This work is licensed under the Apache 2.0 License DefaultPreview()
  • 86. This work is licensed under the Apache 2.0 License PetAdoptionColumn() @Composable fun PetAdoptionInformation() { Column { } }
  • 87. This work is licensed under the Apache 2.0 License PetAdoptionColumn() @Composable fun PetAdoptionInformation() { Column { PetName() PetInformation() } }
  • 88. This work is licensed under the Apache 2.0 License DefaultPreview() @Preview(showBackground = true) @Composable fun DefaultPreview() { PetAdoptionTheme { PetAdoptionInformation() } }
  • 89. This work is licensed under the Apache 2.0 License DefaultPreview()
  • 90. This work is licensed under the Apache 2.0 License Resources()
  • 91. This work is licensed under the Apache 2.0 License Accessing Resources R.drawable.koda
  • 92. This work is licensed under the Apache 2.0 License Accessing Resources R.drawable.koda
  • 93. This work is licensed under the Apache 2.0 License Accessing Resources R.drawable.koda
  • 94. This work is licensed under the Apache 2.0 License Accessing Resources R.drawable.koda
  • 95. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { }
  • 96. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = }
  • 97. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = painterResource(...) }
  • 98. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = painterResource(id = R.drawable.koda) }
  • 99. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = painterResource(id = R.drawable.koda) Image(painter = , contentDescription = ) }
  • 100. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = painterResource(id = R.drawable.koda) Image(painter = image, contentDescription = ) }
  • 101. This work is licensed under the Apache 2.0 License PetImage() @Composable fun PetImage() { val image = painterResource(id = R.drawable.koda) Image(painter = image, contentDescription = "Gray and white dog with a collar sitting on a bed") }
  • 102. This work is licensed under the Apache 2.0 License PetAdoptionInformation() @Composable fun PetAdoptionInformation() { Column { PetImage() PetName() PetInformation() } }
  • 103. This work is licensed under the Apache 2.0 License
  • 104. This work is licensed under the Apache 2.0 License Let’s get started Let’s get started
  • 105. This work is licensed under the Apache 2.0 License g.co/android/basics-compose Start here:
  • 106. This work is licensed under the Apache 2.0 License
  • 107. This work is licensed under the Apache 2.0 License Unit 1: Pathway 3
  • 108. This work is licensed under the Apache 2.0 License Have a Question? Just ask Work on Unit 1, Pathway 3
  • 109. This work is licensed under the Apache 2.0 License Good Luck For Your Solutions

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. 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.
  3. 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.]
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. After you pass a quiz, you will earn a badge like these!
  10. 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]
  11. 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.
  12. 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]
  13. 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.
  14. 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!”.
  15. 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.
  16. 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…
  17. 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.
  18. 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.
  19. Functions need to have a descriptive name so that they can be called from other parts of the program.
  20. 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.
  21. Functions need curly braces that contain the instructions needed to execute a task.
  22. 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.
  23. 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.
  24. 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.
  25. 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”.
  26. 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.
  27. 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.
  28. 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.
  29. All variables must have a name that they can be referenced by.
  30. The data type specifies the type of data that the variable holds. Note that a colon separates the name and data type.
  31. 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.
  32. 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]
  33. 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.
  34. 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.
  35. Open the course page with the link on screen.
  36. Then, click Unit 1 to start the Android Basics course.
  37. Feel free to get started working on pathway 1 independently and don’t hesitate to ask if you have questions.
  38. Welcome back to Compose Camp session 2!
  39. Does anyone have questions since the last session?
  40. 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]
  41. This is what Android Studio looks like: let’s talk about the different components of it.
  42. The Project view displays the files and folders of our project.
  43. The Code view is where we will view and edit code.
  44. To see the Design tab, we click Design at the top right of the window.
  45. 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!”.
  46. To see the Split view, we click Split at the top right of the window.
  47. 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.
  48. In the code view, let’s take a look at the Greeting() function.
  49. In the code view, let’s take a look at the Greeting() function. This function has a Text() Composable that takes in a String parameter named name and says hello to that name.
  50. We can update the text in the Greeting() function to say something else. Let’s update the text to say “Howdy” instead of “Hello”
  51. When we rebuild, we will see the text “Howdy Android” instead of “Hello Android” in the Design tab.
  52. My name isn’t Android and I’m guessing yours isn’t either so let’s learn how to update the name passed into the Greeting() function. The DefaultPreview() is where you set what shows up in the Design tab. The FirstComposeProjectTheme sets the styling for the app. See that the Greeting() function is being called and “Android” is passed in.
  53. Let’s replace the argument passed into Greeting() with “Meghan” instead of “Android”.
  54. Now when we refresh we see “Howdy Meghan” displayed in the Design tab. The Design tab is a great way to quickly see how your UI changes but it is not a replacement for testing your app on an emulator or physical device.
  55. 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.
  56. 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.
  57. You can also choose from a variety API levels.
  58. When the emulator runs you will see this in Android Studio. The device shows the text “Howdy Meghan!”
  59. [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.
  60. 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, for example, if you need help installing Android Studio or getting your app to run on your Android device. Also feel free to ask each other for help and work together to find solutions.
  61. Open the course page with the link we provided you.
  62. Then, click Unit 1 to start the Android Basics course.
  63. We will be going over pathway 2 today.
  64. [You can give them about an 2.5 - 3 hours to work on this, with a break if needed.]
  65. Alright everyone welcome back! How was it? Does anyone want to share what your apps looks like?
  66. Welcome back to the second session of Study Jams, does anyone have questions since the last session?
  67. Today we will really be diving into Jetpack Compose. Jetpack Compose is a modern toolkit for building Android UIs. Compose simplifies and accelerates UI development on Android with less code, powerful tools, and intuitive Kotlin capabilities. With Compose, you can build your UI by defining a set of functions, called composable functions, that take in data and emit UI elements. To illustrate a few important concepts that you’ll learn in this pathway, we will go through a short code demo to create a pet adoption app in compose.
  68. To start, let’s talk about Composable functions. Composable functions are the basic building block of a UI in Compose. A Composable function: Describes some part of your UI. Doesn't return anything. Takes some input and generates what's shown on the screen. Might emit several UI elements.
  69. To see the parts of a Composable function, let’s take a look at the Greeting() function that is in MainActivity when you create a new Compose project.
  70. All Composable functions must have the Composable annotation which informs the Compose compiler that this is a Composable function. If you forget to add this annotation, your code will not compile! An annotation is applied by prefixing its name (the annotation) with the @ character at the beginning of the declaration you are annotating. Annotations are means of attaching extra information to code. This information helps tools like the Jetpack Compose compiler understand the app's code.
  71. You use the fun keyword to denote to the Kotlin compiler that it is a function.
  72. In Compose, function names are capitalized. Note that this is only in Compose, a non Compose function should start with a lowercase letter.
  73. Composable functions can accept parameters. When the value of those parameters change, the displayed UI will change as well.
  74. Composable functions don't return anything. Since Composable functions only describe the UI, they don't construct or create the UI, so there is nothing to return.
  75. For our example app we will be creating a pet adoption app that showcases a pet that is up for adoption. This includes an Image Composable and two Text Composables. We will build the app piece by piece but at the end it will look like this!
  76. We will start by creating a new Composable function called PetName().
  77. Inside of the function body we will add a Text() Composable.
  78. In the Text() Composable we will use the named argument, text, and set it to a String saying: “Bark! My name is Koda”. Feel free to replace the name with a different dog name if you want.
  79. In order to see the contents of PetName() add it into the DefaultPreview().
  80. This is how PetName() shows up in the Design pane. Looks good!
  81. In order to adopt a pet you would want more information about it like it’s age and hobbies. In order to display that we will make another Composable called PetInformation() and displays the Koda’s age and hobbies. Set the text equal to “I’m three years old and I like to bark”.
  82. Now we have two Composables that we want to display. Column and Row are two layout Composables that are used in Compose to arrange multiple Composables.
  83. For this app we will use a Column to arrange the information vertically with PetName() appearing before PetInformation().
  84. In order to add a Column to the app add a new Composable called PetAdoptionInformation() and add a Column Composable inside of it.
  85. Next, add both Composables to the Column. Add PetName() before PetInformation() so that it displays first.
  86. To view the new Column you added, add PetAdoptionInformation() to the DefaultPreview().
  87. This is what the DefaultPreview() looks like with the Column showing. Notice how the PetName() shows up first since we added it to the Column first.
  88. Now that we have the age and information, it’s time to add the photo of Koda. In Android Studio image assets are stored under app → res → drawable. The image asset we are using is named koda.jpg.
  89. We have an image saved in the drawable folder that we want to use for this app. Now, let’s talk about how to access that resource in the app. This is the syntax that we use to access resources. Let’s break down the components of it.
  90. The R represents the R class which is an automatically generated class by Android that contains the IDs of all resources in the project.
  91. Drawable refers to the subdirectory of the res folder that the image is located in.
  92. Lastly, we will specify the Resource ID which is usually saved as the filename.
  93. Let’s hop back into the app! In order to add this photo, we will need to add a new Composable function called PetImage().
  94. Now we will add a val named image to store our image.
  95. We set image to painterResource() which loads a drawable resource image and takes a resource ID as an argument.
  96. Pass in R.drawable.koda as the argument for the painterResource() to load the photo of Koda.
  97. Add an Image() Composable which has two arguments to fill in: painter and contentDescription.
  98. For the painter argument, pass in the image that we defined above the Image() composable.
  99. A contentDescription defines the purpose of a UI element and makes your app more accessible. Accessibility can make it easier for all users, not only those with disabilities, to interact with your app. We will set the image's contentDescription argument to “Gray and white dog with a collar sitting on a bed”. That’s it for the PetImage() Composable!
  100. In the Column of the PetAdoptionInformation(), we will add in the new PetImage() Composable.
  101. When we build and refresh the preview, we will see our final app complete with a photo of Koda! That concludes this lecture. Soon you will be implementing these concepts yourself!
  102. 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, for example, if you need help installing Android Studio or getting your app to run on your Android device. Also feel free to ask each other for help and work together to find solutions.
  103. Open the course page with the link we provided you.
  104. Then, click Unit 1 to start the Android Basics course.
  105. We will be going over pathway 3 today.
  106. [You can give them about an 1.5 - 2 hours to work on this before giving them a break.]
  107. Alright everyone welcome back! How was it? Does anyone want to share what your app looks like?