DSC IIT Patna concluded its first two sessions of Compose Camp held on 1st October'22.
The first session started with the Android studio installation, introduced some of its basic features, and covered how to create a new project.
The second session guided the students about AVD setup and USB debugging. The session further covered Kotlin playground. The topics covered under Kotlin are variable and data types, functions in Kotlin, conditional statements, nullability, classes and objects.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Compose_Camp_Session_1_2.pptx
1. This work is licensed under the Apache 2.0 License
WELCOME TO
COMPOSE CAMP
SESSION 1
01-OCTOBER-2022
5:00 PM - 6:00 PM
2. This work is licensed under the Apache 2.0 License
Jenil Nagrecha
IIT Patna | EEE'24
Facilitator
LinkedIn
I am currently pursuing Electrical and Electronics
Engineering from IIT Patna I've been making mobile
apps for a year by using Android and flutter, I am also
an active member of open-source community for
flutter apps and have created a few apps of my own
you can visit my GitHub profile to know more about my
projects!!
3. This work is licensed under the Apache 2.0 License
Android studio
Installation
Android
Studio Basics
Kotlin
Playground
Learn Basics of Kotlin and
How to use it in Android
Studio.
Learn Basics of Android
Studio and Lookout on
Features of Android
Studio.
Install and set up Android
Studio, so that you can
create your first project
and run it on a device or
emulator.
Topics For Session 1 -
Kotlin Playground
4. 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 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. Android Studio uses IntelliJ IDEA as its foundation
and includes the Android plugin pre-installed along with some
modifications specifically for the Android platform.
5. This work is licensed under the Apache 2.0 License
Installation steps - Windows
The following are the system requirements for Android Studio on Windows.
● 64-bit Microsoft® Windows® 8/10/11
● 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
Check system requirements
6. Download and install
Android Studio
Download Android Studio from the Android Studio download page.
You can Follow this Link for installation - Installation Guide refer this link
8. This work is licensed under the Apache 2.0 License
Refer to this link
Here’s How to create a new project
9. This work is licensed under the Apache 2.0 License
Android Studio Overview (Refer to this link)
10. This work is licensed under the Apache 2.0 License
WELCOME TO
COMPOSE CAMP
SESSION 2
01-OCTOBER-2022
6:00 PM - 7:00 PM
11. This work is licensed under the Apache 2.0 License
Doubts
Express any doubts you
facing in any of above
things we will be
discussing.
AVD is a system installed
on your machine which
enables us to install apps
in android without any
physical device.
Topics For Session 2-
AVD Setup
12. This work is licensed under the Apache 2.0 License
Setup AVD
In this task, you'll use the Device Manager to create an Android Virtual
Device (AVD). An AVD is a software version, also called an emulator, of a
mobile device that runs on your computer and mimics the configuration of
a particular type of Android device. This could be any phone, tablet, TV,
watch, or Android auto device. You'll use the AVD to run the Birthday Card
app.
refer to link
13. This work is licensed under the Apache 2.0 License
Setup AVD refer to link
14. This work is licensed under the Apache 2.0 License
15. This work is licensed under the Apache 2.0 License
16. This work is licensed under the Apache 2.0 License
How to
connect
your
Android
device
17. This work is licensed under the Apache 2.0 License
Enable USB Debugging
● On your Android device, tap Settings > About phone.
● Tap Build number seven times.
● If prompted, enter your device password or pin. You know
you succeeded when you see a You are now a developer!
message.
refer to link
18. This work is licensed under the Apache 2.0 License
From here in computer, you can run
your Android app in AVD or
physical Android device(Just select
the device and click on play button)
19. This work is licensed under the Apache 2.0 License
Kotlin PlayGround
● Variables
● Functions
● Write conditionals in Kotlin
● Use nullability in Kotlin
● Use classes and objects in Kotlin
● Use function types and lambda expressions in Kotlin
20. This work is licensed under the Apache 2.0 License
Variable and data types refer to link
21. This work is licensed under the Apache 2.0 License
Variable and data types
fun main() {
val count: Int = 2
println("You have $count unread messages.")
}
OUTPUT : You have 2 unread messages.
refer to link
22. This work is licensed under the Apache 2.0 License
String :
fun main() {
val nextMeeting = "Next meeting is:"
val date = "January 1"
val reminder = nextMeeting + date
println(reminder)
}
OUTPUT : Next meeting is:January 1
refer to link
23. This work is licensed under the Apache 2.0 License
Double :
fun main() {
val trip1: Double = 3.20
val trip2: Double = 4.10
val trip3: Double = 1.72
val totalTripLength: Double = trip1 + trip2 + trip3
println("$totalTripLength miles left to destination")
}
OUTPUT : 9.02 miles left to destination
24. This work is licensed under the Apache 2.0 License
Boolean :
fun main() {
val notificationsEnabled: Boolean = false
println("Are notifications enabled? " + notificationsEnabled)
}
OUTPUT : Are notifications enabled? false
25. This work is licensed under the Apache 2.0 License
Functions in Kotlin
fun main() {
birthdayGreeting()
}
fun birthdayGreeting() {
println("Happy Birthday, Rover!")
println("You are now 5 years old!")
}
OUTPUT : Happy Birthday, Rover!
You are now 5 years old!
refer to link
26. This work is licensed under the Apache 2.0 License
Return a value from Function
fun birthdayGreeting(): String {
val nameGreeting = "Happy Birthday, Rover!"
val ageGreeting = "You are now 5 years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, Rover!
You are now 5 years old!
fun main() {
val greeting = birthdayGreeting()
println(greeting)
}
refer to link
27. This work is licensed under the Apache 2.0 License
Add a parameter to a function
fun birthdayGreeting(name: String): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now 5 years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, REX!
You are now 5 years old!
fun main() {
println(birthdayGreeting("REX"))
}
refer to link
28. This work is licensed under the Apache 2.0 License
Add parameters to a function
fun birthdayGreeting(name: String, age: Int): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now $age years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, REX!
You are now 6 years old!
fun main() {
println(birthdayGreeting("REX", 6))
}
29. This work is licensed under the Apache 2.0 License
Write Conditionals
● If/Else condition -
30. This work is licensed under the Apache 2.0 License
If/Else Condition
● Take an example over here -
fun main() {
val trafficLightColor = "Black"
if (trafficLightColor == "Red") {
println("Stop")
} else if (trafficLightColor =="Yellow")
{
println("Slow")
} else {
println("Go")
}
}
refer to link
31. This work is licensed under the Apache 2.0 License
Write Conditionals
● When conditional -
32. This work is licensed under the Apache 2.0 License
When Conditional
● Take an example over here -
fun main() {
val trafficLightColor = "Yellow"
when (trafficLightColor) {
"Red" -> println("Stop")
"Yellow" -> println("Slow")
"Green" -> println("Go")
else -> println("Invalid traffic-light color")
}
}
refer to link
33. This work is licensed under the Apache 2.0 License
Nullability in Kotlin
In Unit 1, you learned that when you declare a variable, you need to assign it a value
immediately. For example, when you declare a Favourite Actor variable, you may assign
it a "Sandra" string value immediately.
what if you don't have a
favorite actor?
refer to link
34. This work is licensed under the Apache 2.0 License
Nullability in Kotlin
Nullable vs Non-nullable Variables
fun main() {
var favoriteActor: String =
"Sandra Oh"
favoriteActor = null
println(favoriteActor)
}
Output Error :
fun main() {
var favoriteActor: String? =
"Sandra Oh"
println(favoriteActor)
favoriteActor = null
println(favoriteActor)
}
Output :
Sandra Oh
null
refer to link
35. This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining a Class -
class SmartDevice {
// empty body
}
fun main() {
}
refer to link
36. This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining class methods -
class SmartDevice {
fun turnOn(){
println("Smart device is turned on.")
}
fun turnOff(){
println("Smart device is turned off.")
}
}
fun main() {
val smartTvDevice = SmartDevice()
smartTvDevice.turnOn()
smartTvDevice.turnOff()
}
refer to link
37. This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining class properties -
class SmartDevice {
val name = "Android TV"
val category = "Entertainment"
var deviceStatus = "online"
fun turnOn(){
println("Smart device is turned on.")
}
fun turnOff(){
println("Smart device is turned off.")
}
}
fun main(){
val smartTvDevice = SmartDevice()
println("Device name is: ${smartTvDevice.name}")
smartTvDevice.turnOn()
smartTvDevice.turnOff()
}
refer to link
Must Read
38. This work is licensed under the Apache 2.0 License
Thankyou
See you in session 3
and 4..