SlideShare a Scribd company logo
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Day 1 of Compose Camp
● Kotlin Basics
● Installing Android studio
● Build a Basic Layout
This work is licensed under the Apache 2.0 License
Maruthi R
GDSC LEAD SIT
Camp leaders
Abhishek S
Compose Camp Facilitator
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.
This work is licensed under the Apache 2.0 License
Less code
Do more with less code
And avoid entire classes
Of bugs. Code is simpler,
easier to maintain
Why Jetpack Compose
Intuitive
Just describe your UI,
and compose takes care
of the rest. As app state
changes, your UI
automatically updates
Accelerates
Development
Compatible with all your
existing code so you can
adopt when and where
you want iterate fast with
live previews and full
Android Studio support
Powerful
Create beautiful apps
with direct access to the
Android platform APIs
and built-in support for
Material Design, Dark
Theme, animations, and
more.
This work is licensed under the Apache 2.0 License
● Basic computer literacy
● Basic math skills
● (Optional) Android device & USB cable
Prerequisites
This work is licensed under the Apache 2.0 License
● Set up Android Studio on your computer
● Learn the basics of the Kotlin programming language
● Learn Jetpack Compose
● Learn to create Android App
Compose Camp Learning Objectives
This work is licensed under the Apache 2.0 License
Kotlin
Kotlin is an open-source statically typed
programming language that targets the
JVM, Android, JavaScript and Native.
This work is licensed under the Apache 2.0 License
Jetpack Compose is Android's modern toolkit for building native UI. It
simplifies and accelerates UI development on Android. Quickly bring your
app to life with less code, powerful tools, and intuitive Kotlin APIs.
Jetpack Compose
This work is licensed under the Apache 2.0 License
Ok! Lets get Started
This work is licensed under the Apache 2.0 License
Kotlin Playground
Write and run Kotlin code in
the browser.
https://play.kotlinlang.org/
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
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!
Functions
A function is a segment of a program that
performs a specific task.
You can have many functions in your program
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 or
parameters.
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() {
// Body
}
This work is licensed under the Apache 2.0 License
Putting it together
fun main() {
// code
}
Output:
Welcome to Compose Camp!
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: Abhishek
Age value: 19
Output:
My name is Abhishek and
I am 19 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 main() {
val name: String = "Abhi"
var age: Int = 19
}
This work is licensed under the Apache 2.0 License
Defining a variable
All variables must have a name.
fun main() {
val name: String = "Abhi"
var age: Int = 19
}
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 main() {
val name: String = "Abhi"
var age: Int = 19
}
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 main() {
val name: String = "Abhi"
var age: Int = 19
// val name = “Abhi”
// var age = 19
}
This work is licensed under the Apache 2.0 License
Defining a variable
If we want to define a variable
with no initial value.
fun main() {
val name: String
var age: Int
// var age => Error
}
This work is licensed under the Apache 2.0 License
Putting it together
fun main() {
// Define a variable storing name of a person
// Define a variable storing age of a person
// Print Statement and use of ‘$’ operator
}
This work is licensed under the Apache 2.0 License
Putting it together
fun main() {
// Call a function
}
// Define a function
fun firstFunction() {
// Function Body
}
This work is licensed under the Apache 2.0 License
Return Value
We have to mention what has to
be returned by the function by
providing the data type for it.
If a function does not return
anything then it is having ‘Unit’
return type
fun firstFunction() : String {
// Body
return “value”
}
This work is licensed under the Apache 2.0 License
Parameters
We can define various parameters or inputs for the function
fun firstFunction(age : Int): Int{
// body
return age
}
fun main(){
// calling the function
}
This work is licensed under the Apache 2.0 License
Function with multiple
parameters
fun firstFunction(age : Int, name : String){
// body
}
fun main(){
firstFucntion(21, “yourName”)
}
This work is licensed under the Apache 2.0 License
Named arguments
fun firstFunction(age : Int, name : String){
// body
}
fun main(){
firstFunction(name = “YourName”, age = 20)
}
We need to keep in mind the order of parameters while passing the
arguments so we can use named arguments.
This work is licensed under the Apache 2.0 License
Function with default parameters
fun firstFunction(age : Int, name : String = “noName”){
// body
}
fun main(){
firstFucntion(21, “YourName”)
firstFunction(21)
}
This work is licensed under the Apache 2.0 License
Installing Android Studio
This work is licensed under the Apache 2.0 License
Android Studio
Android Studio is the official
Integrated Development Environment
(IDE) for Android app development,
based on IntelliJ IDEA.
Learners will use Android Studio to build their
Android apps using Compose.
This work is licensed under the Apache 2.0 License
Android Studio System Requirements
Source
Computers must meet these system requirements in order to download Android Studio on them.
Windows
64-bit Microsoft® Windows® 8/10
x86_64 CPU architecture; 2nd
generation Intel Core or newer, or
AMD CPU with support for a
Windows Hypervisor
8 GB RAM or more
8 GB of available disk space
minimum (IDE + Android SDK +
Android Emulator)
1280 x 800 minimum screen
resolution
Mac
MacOS® 10.14 (Mojave) or higher
ARM-based chips, or 2nd
generation Intel Core or newer
with support for
Hypervisor.Framework
8 GB RAM or more
8 GB of available disk space
minimum (IDE + Android SDK +
Android Emulator)
1280 x 800 minimum screen
resolution
Linux
Any 64-bit Linux distribution that
supports Gnome, KDE, or Unity DE;
GNU C Library (glibc) 2.31 or later.
x86_64 CPU architecture; 2nd
generation Intel Core or newer, or
AMD processor with support for
AMD Virtualization (AMD-V) and
SSSE3
8 GB RAM or more
8 GB of available disk space
minimum (IDE + Android SDK +
Android Emulator)
1280 x 800 minimum screen
resolution
Chrome OS
For information on
recommended devices and
specifications, as well as
Android Emulator support,
visit chromeos.dev.
This work is licensed under the Apache 2.0 License
Download Android Studio
Note: If attendees encounter an issue with Android Studio, help them file a bug report.
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
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
Installing Android Studio
This work is licensed under the Apache 2.0 License
Android Studio
Android Studio is the official
Integrated Development Environment
(IDE) for Android app development,
based on IntelliJ IDEA.
Learners will use Android Studio to build their
Android apps using Compose.
This work is licensed under the Apache 2.0 License
THANK YOU
for participating in Compose Camp Day 2

More Related Content

Similar to Compose Camp 2.pdf

Compose Camp #1.pptx
Compose  Camp #1.pptxCompose  Camp #1.pptx
Compose Camp #1.pptx
PratheeGuesylearn
 
Session-1 edited.pptx
Session-1 edited.pptxSession-1 edited.pptx
Session-1 edited.pptx
scienceTech11
 
Compose #1.pptx
Compose #1.pptxCompose #1.pptx
Compose #1.pptx
PratheeGuesylearn
 
Compose Camp Session 2
Compose Camp Session 2Compose Camp Session 2
Compose Camp Session 2
AkshatBajpai12
 
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
AshutoshSingh1124
 
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
 
Compose Camp Session 1.pdf
Compose Camp Session 1.pdfCompose Camp Session 1.pdf
Compose Camp Session 1.pdf
AbhishekRajoraB20CS0
 
-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptx-Kotlin_Camp_Unit2.pptx
-Kotlin_Camp_Unit2.pptx
RishiGandhi19
 
-Kotlin Camp Unit2.pptx
-Kotlin Camp Unit2.pptx-Kotlin Camp Unit2.pptx
-Kotlin Camp Unit2.pptx
IshwariKulkarni6
 
GDSC_day_1.pptx
GDSC_day_1.pptxGDSC_day_1.pptx
GDSC_day_1.pptx
GDSCICOER
 
Compose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptxCompose Camp - Unit 1 (1).pptx
Compose Camp - Unit 1 (1).pptx
IshwariKulkarni6
 
Compose Camp
Compose Camp Compose Camp
Compose Camp
AthravMehta
 
Android study jams
Android study jamsAndroid study jams
Android study jams
NaveenK158
 
Kotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptxKotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptx
takshilkunadia
 
Compose camp 2.pptx
Compose camp 2.pptxCompose camp 2.pptx
Compose camp 2.pptx
bcedsc
 
Compose Camp - Session1.pdf
Compose Camp - Session1.pdfCompose Camp - Session1.pdf
Compose Camp - Session1.pdf
GDSCAtharvaCollegeOf
 
Compose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdfCompose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdf
AryanKhandelwal35
 
Compose Camp - Session2.pdf
Compose Camp - Session2.pdfCompose Camp - Session2.pdf
Compose Camp - Session2.pdf
GDSCAtharvaCollegeOf
 
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENMAndroid Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
GDSCBVCOENM
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience track
AshwinRaj57
 

Similar to Compose Camp 2.pdf (20)

Compose Camp #1.pptx
Compose  Camp #1.pptxCompose  Camp #1.pptx
Compose Camp #1.pptx
 
Session-1 edited.pptx
Session-1 edited.pptxSession-1 edited.pptx
Session-1 edited.pptx
 
Compose #1.pptx
Compose #1.pptxCompose #1.pptx
Compose #1.pptx
 
Compose Camp Session 2
Compose Camp Session 2Compose Camp Session 2
Compose Camp Session 2
 
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
 
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]
 
Compose Camp Session 1.pdf
Compose Camp Session 1.pdfCompose Camp Session 1.pdf
Compose Camp Session 1.pdf
 
-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
 
GDSC_day_1.pptx
GDSC_day_1.pptxGDSC_day_1.pptx
GDSC_day_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
 
Compose Camp
Compose Camp Compose Camp
Compose Camp
 
Android study jams
Android study jamsAndroid study jams
Android study jams
 
Kotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptxKotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptx
 
Compose camp 2.pptx
Compose camp 2.pptxCompose camp 2.pptx
Compose camp 2.pptx
 
Compose Camp - Session1.pdf
Compose Camp - Session1.pdfCompose Camp - Session1.pdf
Compose Camp - Session1.pdf
 
Compose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdfCompose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdf
 
Compose Camp - Session2.pdf
Compose Camp - Session2.pdfCompose Camp - Session2.pdf
Compose Camp - Session2.pdf
 
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENMAndroid Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience track
 

Recently uploaded

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 

Recently uploaded (20)

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 

Compose Camp 2.pdf

  • 1. This work is licensed under the Apache 2.0 License
  • 2. This work is licensed under the Apache 2.0 License Day 1 of Compose Camp ● Kotlin Basics ● Installing Android studio ● Build a Basic Layout
  • 3. This work is licensed under the Apache 2.0 License Maruthi R GDSC LEAD SIT Camp leaders Abhishek S Compose Camp Facilitator
  • 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 Less code Do more with less code And avoid entire classes Of bugs. Code is simpler, easier to maintain Why Jetpack Compose Intuitive Just describe your UI, and compose takes care of the rest. As app state changes, your UI automatically updates Accelerates Development Compatible with all your existing code so you can adopt when and where you want iterate fast with live previews and full Android Studio support Powerful Create beautiful apps with direct access to the Android platform APIs and built-in support for Material Design, Dark Theme, animations, and more.
  • 6. This work is licensed under the Apache 2.0 License ● Basic computer literacy ● Basic math skills ● (Optional) Android device & USB cable Prerequisites
  • 7. This work is licensed under the Apache 2.0 License ● Set up Android Studio on your computer ● Learn the basics of the Kotlin programming language ● Learn Jetpack Compose ● Learn to create Android App Compose Camp Learning Objectives
  • 8. This work is licensed under the Apache 2.0 License Kotlin Kotlin is an open-source statically typed programming language that targets the JVM, Android, JavaScript and Native.
  • 9. This work is licensed under the Apache 2.0 License Jetpack Compose is Android's modern toolkit for building native UI. It simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs. Jetpack Compose
  • 10. This work is licensed under the Apache 2.0 License Ok! Lets get Started
  • 11. This work is licensed under the Apache 2.0 License Kotlin Playground Write and run Kotlin code in the browser. https://play.kotlinlang.org/
  • 12. 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!
  • 13. 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!
  • 14. Functions A function is a segment of a program that performs a specific task. You can have many functions in your program
  • 15. This work is licensed under the Apache 2.0 License Defining a function Functions begin with the fun keyword. fun displayIntroduction() { }
  • 16. 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() { }
  • 17. 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 or parameters. fun displayIntroduction() { }
  • 18. 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() { // Body }
  • 19. This work is licensed under the Apache 2.0 License Putting it together fun main() { // code } Output: Welcome to Compose Camp!
  • 20. This work is licensed under the Apache 2.0 License A container for a single piece of data. Variables
  • 21. This work is licensed under the Apache 2.0 License My name is and I am years old Variables name age
  • 22. This work is licensed under the Apache 2.0 License My name is and I am years old Variables Name value: Abhishek Age value: 19 Output: My name is Abhishek and I am 19 years old Name value: Janet Age value: 49 Output: My name is Janet and I am 49 years old name age
  • 23. 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
  • 24. 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
  • 25. This work is licensed under the Apache 2.0 License Defining a variable Variables start with a var or val keyword. fun main() { val name: String = "Abhi" var age: Int = 19 }
  • 26. This work is licensed under the Apache 2.0 License Defining a variable All variables must have a name. fun main() { val name: String = "Abhi" var age: Int = 19 }
  • 27. 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 main() { val name: String = "Abhi" var age: Int = 19 }
  • 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 main() { val name: String = "Abhi" var age: Int = 19 // val name = “Abhi” // var age = 19 }
  • 29. This work is licensed under the Apache 2.0 License Defining a variable If we want to define a variable with no initial value. fun main() { val name: String var age: Int // var age => Error }
  • 30. This work is licensed under the Apache 2.0 License Putting it together fun main() { // Define a variable storing name of a person // Define a variable storing age of a person // Print Statement and use of ‘$’ operator }
  • 31. This work is licensed under the Apache 2.0 License Putting it together fun main() { // Call a function } // Define a function fun firstFunction() { // Function Body }
  • 32. This work is licensed under the Apache 2.0 License Return Value We have to mention what has to be returned by the function by providing the data type for it. If a function does not return anything then it is having ‘Unit’ return type fun firstFunction() : String { // Body return “value” }
  • 33. This work is licensed under the Apache 2.0 License Parameters We can define various parameters or inputs for the function fun firstFunction(age : Int): Int{ // body return age } fun main(){ // calling the function }
  • 34. This work is licensed under the Apache 2.0 License Function with multiple parameters fun firstFunction(age : Int, name : String){ // body } fun main(){ firstFucntion(21, “yourName”) }
  • 35. This work is licensed under the Apache 2.0 License Named arguments fun firstFunction(age : Int, name : String){ // body } fun main(){ firstFunction(name = “YourName”, age = 20) } We need to keep in mind the order of parameters while passing the arguments so we can use named arguments.
  • 36. This work is licensed under the Apache 2.0 License Function with default parameters fun firstFunction(age : Int, name : String = “noName”){ // body } fun main(){ firstFucntion(21, “YourName”) firstFunction(21) }
  • 37. This work is licensed under the Apache 2.0 License Installing Android Studio
  • 38. This work is licensed under the Apache 2.0 License Android Studio Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJ IDEA. Learners will use Android Studio to build their Android apps using Compose.
  • 39. This work is licensed under the Apache 2.0 License Android Studio System Requirements Source Computers must meet these system requirements in order to download Android Studio on them. Windows 64-bit Microsoft® Windows® 8/10 x86_64 CPU architecture; 2nd generation Intel Core or newer, or AMD CPU with support for a Windows Hypervisor 8 GB RAM or more 8 GB of available disk space minimum (IDE + Android SDK + Android Emulator) 1280 x 800 minimum screen resolution Mac MacOS® 10.14 (Mojave) or higher ARM-based chips, or 2nd generation Intel Core or newer with support for Hypervisor.Framework 8 GB RAM or more 8 GB of available disk space minimum (IDE + Android SDK + Android Emulator) 1280 x 800 minimum screen resolution Linux Any 64-bit Linux distribution that supports Gnome, KDE, or Unity DE; GNU C Library (glibc) 2.31 or later. x86_64 CPU architecture; 2nd generation Intel Core or newer, or AMD processor with support for AMD Virtualization (AMD-V) and SSSE3 8 GB RAM or more 8 GB of available disk space minimum (IDE + Android SDK + Android Emulator) 1280 x 800 minimum screen resolution Chrome OS For information on recommended devices and specifications, as well as Android Emulator support, visit chromeos.dev.
  • 40. This work is licensed under the Apache 2.0 License Download Android Studio Note: If attendees encounter an issue with Android Studio, help them file a bug report.
  • 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 - Project View
  • 43. This work is licensed under the Apache 2.0 License Android Studio - Code 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 - Design 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 - Split View
  • 48. 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?
  • 49. This work is licensed under the Apache 2.0 License Creating an emulator
  • 50. This work is licensed under the Apache 2.0 License Creating an emulator
  • 51. This work is licensed under the Apache 2.0 License Installing Android Studio
  • 52. This work is licensed under the Apache 2.0 License Android Studio Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJ IDEA. Learners will use Android Studio to build their Android apps using Compose.
  • 53. This work is licensed under the Apache 2.0 License THANK YOU for participating in Compose Camp Day 2