SlideShare a Scribd company logo
This work is licensed under the Apache 2.0 License
Compose Camp
Session 3
Google Developer Student Clubs
M.S.Bidve Engineering College Latur
This work is licensed under the Apache 2.0 License
Unit 3:
DISPLAY LISTS AND
USE USE MATERIAL
DESIGN
This work is licensed under the Apache 2.0 License
Contents
-Kotlin fundamentals
-Build a scrollable list
-Display list
-Material design
This work is licensed under the Apache 2.0 License
Generics, Objects and Extensions
Make a reusable class with generics
Let’s say you’re writing an app for an online quiz , similar to the
quizzes you’ve seen in this course. There are often multiple types
of quiz questions, such as fill in the blank, or true or false. An
individual quiz question can be represented by a class, with
several properties
1. Fill in the blank question: The answer is a word represented
by a string.
2. True or false question: The answer is represented by a
boolean.
3. Math problems: The answer is numeric value. The answer for
a simple arithmetic problem is represented by an int.
This work is licensed under the Apache 2.0 License
What is Generic Data Type?
Generic types, or generics for short, allow a data type, such as class, to specify an unknown
place holder data type that can be used with its properties and methods. What exactly does
this mean?
In the above example, instead of defining an answer properly for each possible data type,
you can create a single class to represent any question, and use a placeholder name for the
data type of the answer properly. The actual data type string, int, boolean, etc. is specified
when that class is instantiated. Wherever the placeholder name is used, the data type
passed into the class is used instead.
This work is licensed under the Apache 2.0 License
Refactor Your Code to Use Generics
A generic data type is provided when instantiating a class, so it
needs to be defined as part of the class signatures. After the
class name comes a left facing (<), followed by a placeholder
name for the data type, followed by right facing angle bracket
(>).
The placeholder name can then be used wherever you use a real
data type within the class such as for a property.
Refactor
Refactor your code to use a single class name question with a
generic answer property
class Questions<T>(
val questionText:
String,
val answer : T,
val difficulty: String
)
class Class name < generic data type
properties
>(
)
This work is licensed under the Apache 2.0 License
https://developer.android.com/courses/and
roid-basics-compose/unit-3

More Related Content

Similar to Session 3.pptx

Bt0082 visual basic
Bt0082   visual basicBt0082   visual basic
Bt0082 visual basic
smumbahelp
 
CSC388 Online Programming Languages Homework 3 (due b.docx
CSC388 Online Programming Languages  Homework 3 (due b.docxCSC388 Online Programming Languages  Homework 3 (due b.docx
CSC388 Online Programming Languages Homework 3 (due b.docx
annettsparrow
 
My c++
My c++My c++
My c++
snathick
 
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
MATCHmaster
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
Connex
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
siragezeynu
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Krishnaov
 
Prg421
Prg421Prg421
Prg421
john roy
 
Inheritance in OOPs with java
Inheritance in OOPs with javaInheritance in OOPs with java
Inheritance in OOPs with java
AAKANKSHA JAIN
 
Bt0074, oops with java
Bt0074, oops with javaBt0074, oops with java
Bt0074, oops with java
smumbahelp
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)
dannygriff1
 
Chapter 7 java
Chapter 7 javaChapter 7 java
Chapter 7 java
Ahmad sohail Kakar
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
Greg Sohl
 
The Ring programming language version 1.5.2 book - Part 70 of 181
The Ring programming language version 1.5.2 book - Part 70 of 181The Ring programming language version 1.5.2 book - Part 70 of 181
The Ring programming language version 1.5.2 book - Part 70 of 181
Mahmoud Samir Fayed
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
talha ijaz
 
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptxInheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptx
ABHINAVARYANCSEA301
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
rumanatasnim415
 
Use Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.pptUse Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.ppt
manishchoudhary91861
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++
smumbahelp
 

Similar to Session 3.pptx (20)

Bt0082 visual basic
Bt0082   visual basicBt0082   visual basic
Bt0082 visual basic
 
CSC388 Online Programming Languages Homework 3 (due b.docx
CSC388 Online Programming Languages  Homework 3 (due b.docxCSC388 Online Programming Languages  Homework 3 (due b.docx
CSC388 Online Programming Languages Homework 3 (due b.docx
 
My c++
My c++My c++
My c++
 
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Prg421
Prg421Prg421
Prg421
 
Inheritance in OOPs with java
Inheritance in OOPs with javaInheritance in OOPs with java
Inheritance in OOPs with java
 
Bt0074, oops with java
Bt0074, oops with javaBt0074, oops with java
Bt0074, oops with java
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)
 
Chapter 7 java
Chapter 7 javaChapter 7 java
Chapter 7 java
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
The Ring programming language version 1.5.2 book - Part 70 of 181
The Ring programming language version 1.5.2 book - Part 70 of 181The Ring programming language version 1.5.2 book - Part 70 of 181
The Ring programming language version 1.5.2 book - Part 70 of 181
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptxInheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptx
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
 
Use Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.pptUse Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.ppt
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++
 

Recently uploaded

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
anfaltahir1010
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 

Recently uploaded (20)

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 

Session 3.pptx

  • 1. This work is licensed under the Apache 2.0 License Compose Camp Session 3 Google Developer Student Clubs M.S.Bidve Engineering College Latur
  • 2. This work is licensed under the Apache 2.0 License Unit 3: DISPLAY LISTS AND USE USE MATERIAL DESIGN
  • 3. This work is licensed under the Apache 2.0 License Contents -Kotlin fundamentals -Build a scrollable list -Display list -Material design
  • 4. This work is licensed under the Apache 2.0 License Generics, Objects and Extensions Make a reusable class with generics Let’s say you’re writing an app for an online quiz , similar to the quizzes you’ve seen in this course. There are often multiple types of quiz questions, such as fill in the blank, or true or false. An individual quiz question can be represented by a class, with several properties 1. Fill in the blank question: The answer is a word represented by a string. 2. True or false question: The answer is represented by a boolean. 3. Math problems: The answer is numeric value. The answer for a simple arithmetic problem is represented by an int.
  • 5. This work is licensed under the Apache 2.0 License What is Generic Data Type? Generic types, or generics for short, allow a data type, such as class, to specify an unknown place holder data type that can be used with its properties and methods. What exactly does this mean? In the above example, instead of defining an answer properly for each possible data type, you can create a single class to represent any question, and use a placeholder name for the data type of the answer properly. The actual data type string, int, boolean, etc. is specified when that class is instantiated. Wherever the placeholder name is used, the data type passed into the class is used instead.
  • 6. This work is licensed under the Apache 2.0 License Refactor Your Code to Use Generics A generic data type is provided when instantiating a class, so it needs to be defined as part of the class signatures. After the class name comes a left facing (<), followed by a placeholder name for the data type, followed by right facing angle bracket (>). The placeholder name can then be used wherever you use a real data type within the class such as for a property. Refactor Refactor your code to use a single class name question with a generic answer property class Questions<T>( val questionText: String, val answer : T, val difficulty: String ) class Class name < generic data type properties >( )
  • 7. This work is licensed under the Apache 2.0 License https://developer.android.com/courses/and roid-basics-compose/unit-3