SlideShare a Scribd company logo
1 of 54
This work is licensed under the Apache 2.0 License
Day 2
Android Studio
This work is licensed under the Apache 2.0 License
Community Page
This work is licensed under the Apache 2.0 License
a
Our Social Handles
GDSC_ICOER
What We Did In Last Session
This work is licensed under
the Apache 2.0 License
This work is licensed under the Apache 2.0 License
What is Kotlin?
● Kotlin is a programming language
developed by JetBrains.
● Kotlin was made open source in the year
2011.
● Previously Java was considered as the
official language of Android Development.
This work is licensed under the Apache 2.0 License
Function Declaration
We have to use the fun keyword for declaring
any function.
Syntax:
fun function_name()
{
//Statements or code.
}
This work is licensed under the Apache 2.0 License
Conditions
Conditional statements decide the flow of program
There are four types of conditional statements:
1) If : The block will only execute if the condition is true
fun main() {
var a=5
if(a==5)
println(“Five”)
}
This work is licensed under the Apache 2.0 License
Conditions
2) If else: The if block will execute only when the condition is true
otherwise the else block will get executed.
//Even Or Odd
fun main() {
var a=5
if(a%2==0)
println(“Even”)
else
println(“Odd”)
}
This work is licensed under the Apache 2.0 License
Conditions
3) If else if else:
//Even Or Odd Or Zero
fun main() {
var a=5
if(a==0)
println(“Zero”)
else if(a%2==0)
println(“Even”)
else
println(“Odd”)
}
This work is licensed under the Apache 2.0 License
Conditions
4) If else:
//Even Or Odd Or Zero
fun main() {
var a=5
if(a==0)
println(“Zero”)
else
{
if(a%2==0)
println(“Even”)
else
println(“Odd”)
}
}
This work is licensed under the Apache 2.0 License
Conditions
5) Nested if:
fun main() {
var a=5
if(a%2!=0) {
if(a>=5) {
println(“Can be five or greater”)
}
}
}
6) When Statement:
When statement is used to remove the extra use of conditional
statements.
Let us design a calculator
Example:
fun main() {
var a:Int = 5
var b:Int =3
var c:Char=’+’
}
when(c)
{
‘+’ -> println(a+b)
‘-’ -> println(a-b)
‘*’ -> println(a*b)
‘/’ -> println(a/b)
‘%’ -> println(a%b)
else -> println(“Incorrect”)
}
}
This work is licensed under the Apache 2.0 License
Introduction to Android Studio
Android Studio is the official Integrated Development Environment (IDE) for
Android app development, based on IntelliJ IDEA .
Android Studio offers even more features that enhance your productivity when
building Android apps
This work is licensed under the Apache 2.0 License
Requirements For Android
Studio
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
This work is licensed under the Apache 2.0 License
Set up Android
Studio :)
Install and set up Android Studio, so
that you can create your own projects
and run them on a device or emulator.
This work is licensed under the Apache 2.0 License
Step 1 : Download Android Studio
1. Open any web browser and navigate to the Android Studio download page.
Click Download Android Studio. The Terms and Conditions page with the Android Studio License Agreement
opens.
2. Click Download Android Studio to start the download.
3. When prompted, save the file to a location where you can easily locate it, such as the Downloads
folder.
4. Download -> Save -> Install -> Create!
This work is licensed under the Apache 2.0 License
Step 2 :- Install Android Studio
This work is licensed under the Apache 2.0 License
Choose Your
Preferred UI
Theme.
Step 2 : Install Android
Studio
This work is licensed under the Apache 2.0 License
Step 2 : Install Android Studio
This work is licensed under the Apache 2.0 License
Congratulations! You've
successfully installed
Android Studio. Now
you're ready for the next
step! 🥳
Step 2 : Install Android
Studio
This work is licensed under the Apache 2.0 License
Android Studio
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
1. Double click the Android Studio icon to launch Android Studio.
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
2. In the Welcome to Android Studio dialog, click New Project.
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
3. From the list of templates provided by Android Studio Select Phone and Tablet tab is
selected.
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
4. Fill the required information.
5. Hit Finish. This may take a while
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
6. You may see a What's New pane which contains updates on new features in Android Studio.
Close it for now.
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
7. Click Split on the top right of Android Studio, this allows you to view both code and
design.After pressing Split you should see three areas.
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
8. In the Design view, you will see a blank pane with this text
This work is licensed under the Apache 2.0 License
Step 3 : Create First Project
9. Click Build & Refresh. It may take a while to build but when it is done the preview shows a text
box that says "Hello Android!".
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
1. In Android Studio, select Tools > Device Manager.
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
2. Click Create Virtual Device.
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
3. Select Phone as the category.
4. Select a phone, such as the Pixel 5, and then click Next.
5. If there's a download link next to S, click Download > Accept > Next > Finish.
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
6. In the Recommended tab, choose S as the version of Android to run on the virtual device.
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
This action opens another screen, where you can choose additional configuration details for
your device.
This work is licensed under the Apache 2.0 License
Step 4 : Set Up Android Emulator
7. In the AVD Name field, enter a name for your AVD or use the default. Leave the rest of
the fields unchanged.
8. Click Finish.
This work is licensed under the Apache 2.0 License
Android Studio
Emulator
Default Preview
Corporate needs you to find the differences between
this picture and this picture.
This work is licensed under the Apache 2.0 License
Run your first app on the Android Emulator
1. Select the virtual device that you created from the dropdown
menu at the top of the Android Studio window.
This work is licensed under the Apache 2.0 License
Run your first app on the Android Emulator
2. Click
This work is licensed under the Apache 2.0 License
Run your first app on the Android Emulator
This work is licensed under the Apache 2.0 License
Run your first app on the Android Emulator
When your app is ready, it opens on the virtual device.
This work is licensed under the Apache 2.0 License
How to connect your Android device
1. On your Android device, tap Settings > About phone.
2. Tap Build number seven times.
3. If prompted, enter your device password or pin. You know you
succeeded when you see a You are now a developer! message.
This work is licensed under the Apache 2.0 License
How to connect your Android device
4. Return to Settings and then tap System > Developer options.
5. If you don't see Developer options, tap Advanced options.
This work is licensed under the Apache 2.0 License
How to connect your Android device
6. Tap Developer options and then tap the USB debugging toggle to turn it on.
This work is licensed under the Apache 2.0 License
How to connect your Android device
Install the Google USB Driver (Windows only)
1. In Android Studio, click Tools > SDK Manager. The Preferences > Appearance & Behavior System
Settings > Android SDK dialog opens.
2. Click the SDK Tools tab.
3. Select Google USB Driver and then click OK.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with a cable
1. Connect your Android device to your computer with a USB cable. A dialog should
appear on your device, which asks you to allow USB debugging.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with a cable
1. Select the Always allow from this computer checkbox and then tap OK.
2. In Android Studio on your computer, make sure your device is selected in the dropdown.
3. Click
4. Select your device and then click OK. Android Studio installs the app on your device
and runs it.
5. If your device runs an Android platform that isn't installed in Android Studio and you
see a message that asks whether you want to install the needed platform, click Install
> Continue > Finish. Android Studio installs the app on your device and runs it.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with Wi-Fi
Get started
1. Ensure that your computer and device are connected to the same wireless network.
2. Ensure that your device runs Android 11 or higher. For more information, see Check &
update your Android version.
3. Ensure that your computer has the latest version of Android Studio. To download it,
see Android Studio.
4. Ensure that your computer has the latest version of the SDK Platform Tools.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with Wi-Fi
1. In Android Studio, select Pair Devices Using Wi-Fi from the run configurations drop-down
menu.
This work is licensed under the Apache 2.0 License
The Pair devices over Wi-Fi dialog opens.
Run your app on the
Android device with
Wi-Fi
This work is licensed under the Apache 2.0 License
Run your app on the Android device with Wi-Fi
2. Go to Developer options, scroll down to the Debugging section and turn on Wireless
debugging.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with Wi-Fi
3. On the Allow wireless debugging on this network? popup, select Allow.
This work is licensed under the Apache 2.0 License
Run your app on the Android device with Wi-Fi
4. If you want to pair your device with a QR code, select Pair device with QR code and
then scan the QR code on your computer. Alternatively, if you want to pair your
device with a pairing code, select Pair device with pairing code and then enter the
6-digit code.
5. Click run and you can deploy your app to your device.
thank you

More Related Content

Similar to Day2GDSC.pptx

Compose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdfCompose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdfAryanKhandelwal35
 
Android study jams
Android study jamsAndroid study jams
Android study jamsNaveenK158
 
02 getting start with android app development
02 getting start with android app development02 getting start with android app development
02 getting start with android app developmentSokngim Sa
 
Your first Android App
Your first Android AppYour first Android App
Your first Android AppMuhammad Sajid
 
Homework seriesandroidworkshop JUly 12th
Homework seriesandroidworkshop JUly 12thHomework seriesandroidworkshop JUly 12th
Homework seriesandroidworkshop JUly 12thRishi Kumar
 
Android software development – the first few hours
Android software development – the first few hoursAndroid software development – the first few hours
Android software development – the first few hourssjmarsh
 
Week 1 - Android Study Jams
Week 1 - Android Study JamsWeek 1 - Android Study Jams
Week 1 - Android Study JamsJoannaCamille2
 
Jetpack Compose Session 2 (1).pptx
Jetpack Compose Session 2 (1).pptxJetpack Compose Session 2 (1).pptx
Jetpack Compose Session 2 (1).pptxShubhamJogdand8
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Android Wear Code Lab
Android Wear Code LabAndroid Wear Code Lab
Android Wear Code LabGerard
 
Android Development Tools and Installation
Android Development Tools and InstallationAndroid Development Tools and Installation
Android Development Tools and InstallationProf. Erwin Globio
 
Hello android example.
Hello android example.Hello android example.
Hello android example.Rahul Rana
 
DSC Android Study Jam
DSC Android Study JamDSC Android Study Jam
DSC Android Study JamDSC GVP
 
Compose Camp: Introduction to Kotlin.pptx
Compose Camp: Introduction to Kotlin.pptxCompose Camp: Introduction to Kotlin.pptx
Compose Camp: Introduction to Kotlin.pptxAmruthasriAmaravati
 
Compose Camp Slide Session 1
Compose Camp Slide Session 1Compose Camp Slide Session 1
Compose Camp Slide Session 1AkshatBajpai12
 
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
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android developmentGhufran Hashmi
 

Similar to Day2GDSC.pptx (20)

Compose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdfCompose Camp Slide.pptx (1).pdf
Compose Camp Slide.pptx (1).pdf
 
Android study jams
Android study jamsAndroid study jams
Android study jams
 
Appium- part 1
Appium- part 1Appium- part 1
Appium- part 1
 
02 getting start with android app development
02 getting start with android app development02 getting start with android app development
02 getting start with android app development
 
Your first Android App
Your first Android AppYour first Android App
Your first Android App
 
Homework seriesandroidworkshop JUly 12th
Homework seriesandroidworkshop JUly 12thHomework seriesandroidworkshop JUly 12th
Homework seriesandroidworkshop JUly 12th
 
Android software development – the first few hours
Android software development – the first few hoursAndroid software development – the first few hours
Android software development – the first few hours
 
Week 1 - Android Study Jams
Week 1 - Android Study JamsWeek 1 - Android Study Jams
Week 1 - Android Study Jams
 
Jetpack Compose Session 2 (1).pptx
Jetpack Compose Session 2 (1).pptxJetpack Compose Session 2 (1).pptx
Jetpack Compose Session 2 (1).pptx
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Android Wear Code Lab
Android Wear Code LabAndroid Wear Code Lab
Android Wear Code Lab
 
Android Development Tools and Installation
Android Development Tools and InstallationAndroid Development Tools and Installation
Android Development Tools and Installation
 
Hello android example.
Hello android example.Hello android example.
Hello android example.
 
DSC Android Study Jam
DSC Android Study JamDSC Android Study Jam
DSC Android Study Jam
 
Compose Camp: Introduction to Kotlin.pptx
Compose Camp: Introduction to Kotlin.pptxCompose Camp: Introduction to Kotlin.pptx
Compose Camp: Introduction to Kotlin.pptx
 
Compose Camp Slide Session 1
Compose Camp Slide Session 1Compose Camp Slide Session 1
Compose Camp Slide Session 1
 
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
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android development
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Day2GDSC.pptx

  • 1. This work is licensed under the Apache 2.0 License Day 2 Android Studio
  • 2. This work is licensed under the Apache 2.0 License Community Page
  • 3. This work is licensed under the Apache 2.0 License a Our Social Handles GDSC_ICOER
  • 4. What We Did In Last Session This work is licensed under the Apache 2.0 License
  • 5. This work is licensed under the Apache 2.0 License What is Kotlin? ● Kotlin is a programming language developed by JetBrains. ● Kotlin was made open source in the year 2011. ● Previously Java was considered as the official language of Android Development.
  • 6. This work is licensed under the Apache 2.0 License Function Declaration We have to use the fun keyword for declaring any function. Syntax: fun function_name() { //Statements or code. }
  • 7. This work is licensed under the Apache 2.0 License Conditions Conditional statements decide the flow of program There are four types of conditional statements: 1) If : The block will only execute if the condition is true fun main() { var a=5 if(a==5) println(“Five”) }
  • 8. This work is licensed under the Apache 2.0 License Conditions 2) If else: The if block will execute only when the condition is true otherwise the else block will get executed. //Even Or Odd fun main() { var a=5 if(a%2==0) println(“Even”) else println(“Odd”) }
  • 9. This work is licensed under the Apache 2.0 License Conditions 3) If else if else: //Even Or Odd Or Zero fun main() { var a=5 if(a==0) println(“Zero”) else if(a%2==0) println(“Even”) else println(“Odd”) }
  • 10. This work is licensed under the Apache 2.0 License Conditions 4) If else: //Even Or Odd Or Zero fun main() { var a=5 if(a==0) println(“Zero”) else { if(a%2==0) println(“Even”) else println(“Odd”) } }
  • 11. This work is licensed under the Apache 2.0 License Conditions 5) Nested if: fun main() { var a=5 if(a%2!=0) { if(a>=5) { println(“Can be five or greater”) } } }
  • 12. 6) When Statement: When statement is used to remove the extra use of conditional statements. Let us design a calculator Example: fun main() { var a:Int = 5 var b:Int =3 var c:Char=’+’ }
  • 13. when(c) { ‘+’ -> println(a+b) ‘-’ -> println(a-b) ‘*’ -> println(a*b) ‘/’ -> println(a/b) ‘%’ -> println(a%b) else -> println(“Incorrect”) } }
  • 14. This work is licensed under the Apache 2.0 License Introduction to Android Studio Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJ IDEA . Android Studio offers even more features that enhance your productivity when building Android apps
  • 15. This work is licensed under the Apache 2.0 License Requirements For Android Studio 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
  • 16. This work is licensed under the Apache 2.0 License Set up Android Studio :) Install and set up Android Studio, so that you can create your own projects and run them on a device or emulator.
  • 17. This work is licensed under the Apache 2.0 License Step 1 : Download Android Studio 1. Open any web browser and navigate to the Android Studio download page. Click Download Android Studio. The Terms and Conditions page with the Android Studio License Agreement opens. 2. Click Download Android Studio to start the download. 3. When prompted, save the file to a location where you can easily locate it, such as the Downloads folder. 4. Download -> Save -> Install -> Create!
  • 18. This work is licensed under the Apache 2.0 License Step 2 :- Install Android Studio
  • 19. This work is licensed under the Apache 2.0 License Choose Your Preferred UI Theme. Step 2 : Install Android Studio
  • 20. This work is licensed under the Apache 2.0 License Step 2 : Install Android Studio
  • 21. This work is licensed under the Apache 2.0 License Congratulations! You've successfully installed Android Studio. Now you're ready for the next step! 🥳 Step 2 : Install Android Studio
  • 22. This work is licensed under the Apache 2.0 License Android Studio
  • 23. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 1. Double click the Android Studio icon to launch Android Studio.
  • 24. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 2. In the Welcome to Android Studio dialog, click New Project.
  • 25. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 3. From the list of templates provided by Android Studio Select Phone and Tablet tab is selected.
  • 26. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 4. Fill the required information. 5. Hit Finish. This may take a while
  • 27. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 6. You may see a What's New pane which contains updates on new features in Android Studio. Close it for now.
  • 28. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 7. Click Split on the top right of Android Studio, this allows you to view both code and design.After pressing Split you should see three areas.
  • 29. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 8. In the Design view, you will see a blank pane with this text
  • 30. This work is licensed under the Apache 2.0 License Step 3 : Create First Project 9. Click Build & Refresh. It may take a while to build but when it is done the preview shows a text box that says "Hello Android!".
  • 31. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator 1. In Android Studio, select Tools > Device Manager.
  • 32. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator 2. Click Create Virtual Device.
  • 33. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator 3. Select Phone as the category. 4. Select a phone, such as the Pixel 5, and then click Next. 5. If there's a download link next to S, click Download > Accept > Next > Finish.
  • 34. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator 6. In the Recommended tab, choose S as the version of Android to run on the virtual device.
  • 35. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator This action opens another screen, where you can choose additional configuration details for your device.
  • 36. This work is licensed under the Apache 2.0 License Step 4 : Set Up Android Emulator 7. In the AVD Name field, enter a name for your AVD or use the default. Leave the rest of the fields unchanged. 8. Click Finish.
  • 37. This work is licensed under the Apache 2.0 License Android Studio Emulator Default Preview Corporate needs you to find the differences between this picture and this picture.
  • 38. This work is licensed under the Apache 2.0 License Run your first app on the Android Emulator 1. Select the virtual device that you created from the dropdown menu at the top of the Android Studio window.
  • 39. This work is licensed under the Apache 2.0 License Run your first app on the Android Emulator 2. Click
  • 40. This work is licensed under the Apache 2.0 License Run your first app on the Android Emulator
  • 41. This work is licensed under the Apache 2.0 License Run your first app on the Android Emulator When your app is ready, it opens on the virtual device.
  • 42. This work is licensed under the Apache 2.0 License How to connect your Android device 1. On your Android device, tap Settings > About phone. 2. Tap Build number seven times. 3. If prompted, enter your device password or pin. You know you succeeded when you see a You are now a developer! message.
  • 43. This work is licensed under the Apache 2.0 License How to connect your Android device 4. Return to Settings and then tap System > Developer options. 5. If you don't see Developer options, tap Advanced options.
  • 44. This work is licensed under the Apache 2.0 License How to connect your Android device 6. Tap Developer options and then tap the USB debugging toggle to turn it on.
  • 45. This work is licensed under the Apache 2.0 License How to connect your Android device Install the Google USB Driver (Windows only) 1. In Android Studio, click Tools > SDK Manager. The Preferences > Appearance & Behavior System Settings > Android SDK dialog opens. 2. Click the SDK Tools tab. 3. Select Google USB Driver and then click OK.
  • 46. This work is licensed under the Apache 2.0 License Run your app on the Android device with a cable 1. Connect your Android device to your computer with a USB cable. A dialog should appear on your device, which asks you to allow USB debugging.
  • 47. This work is licensed under the Apache 2.0 License Run your app on the Android device with a cable 1. Select the Always allow from this computer checkbox and then tap OK. 2. In Android Studio on your computer, make sure your device is selected in the dropdown. 3. Click 4. Select your device and then click OK. Android Studio installs the app on your device and runs it. 5. If your device runs an Android platform that isn't installed in Android Studio and you see a message that asks whether you want to install the needed platform, click Install > Continue > Finish. Android Studio installs the app on your device and runs it.
  • 48. This work is licensed under the Apache 2.0 License Run your app on the Android device with Wi-Fi Get started 1. Ensure that your computer and device are connected to the same wireless network. 2. Ensure that your device runs Android 11 or higher. For more information, see Check & update your Android version. 3. Ensure that your computer has the latest version of Android Studio. To download it, see Android Studio. 4. Ensure that your computer has the latest version of the SDK Platform Tools.
  • 49. This work is licensed under the Apache 2.0 License Run your app on the Android device with Wi-Fi 1. In Android Studio, select Pair Devices Using Wi-Fi from the run configurations drop-down menu.
  • 50. This work is licensed under the Apache 2.0 License The Pair devices over Wi-Fi dialog opens. Run your app on the Android device with Wi-Fi
  • 51. This work is licensed under the Apache 2.0 License Run your app on the Android device with Wi-Fi 2. Go to Developer options, scroll down to the Debugging section and turn on Wireless debugging.
  • 52. This work is licensed under the Apache 2.0 License Run your app on the Android device with Wi-Fi 3. On the Allow wireless debugging on this network? popup, select Allow.
  • 53. This work is licensed under the Apache 2.0 License Run your app on the Android device with Wi-Fi 4. If you want to pair your device with a QR code, select Pair device with QR code and then scan the QR code on your computer. Alternatively, if you want to pair your device with a pairing code, select Pair device with pairing code and then enter the 6-digit code. 5. Click run and you can deploy your app to your device.