Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin sintax overview
Search
Felipe Oliveira
April 30, 2016
Programming
0
77
Kotlin sintax overview
This talk is result of my presentation on AndroidStudyJams Maceió
Felipe Oliveira
April 30, 2016
Tweet
Share
More Decks by Felipe Oliveira
See All by Felipe Oliveira
Validação com Android Saripaar 2
oliveiradev
0
80
Other Decks in Programming
See All in Programming
AWS発のAIエディタKiroを使ってみた
iriikeita
1
190
OSS開発者という働き方
andpad
5
1.7k
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
22
5.9k
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
560
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
print("Hello, World")
eddie
2
530
はじめてのMaterial3 Expressive
ym223
2
900
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
Navigating Dependency Injection with Metro
zacsweers
3
2.5k
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
1
640
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
520
個人開発で徳島大学生60%以上の心を掴んだアプリ、そして手放した話
akidon0000
1
150
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.1k
Done Done
chrislema
185
16k
Typedesign – Prime Four
hannesfritz
42
2.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
A better future with KSS
kneath
239
17k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
BBQ
matthewcrist
89
9.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Transcript
Kotlin for Android Felipe Oliveira oliveiradev
Felipe Oliveira
Linguagem foi criada pela JetBrains, Kotlin roda na JVM e
é 100% interoperável com Java.
None
Sintaxe overview: atributos
Sintaxe overview: métodos
Sintaxe overview: classes class Person {} open class Person {}
data class Person(val name: String, val age: Int)
Sintaxe overview: Null safety val person: Person? = Person("Felipe",24) fun
main(args: Array<String>) { print(person?.name) }
Sintaxe overview: Default arguments fun query(table: String, columns: Array<String>, orderBy:
String? = null, limit: Int? = null){ ... } query("PEOPLE", arrayOf("ID","NAME")) query("PEOPLE", arrayOf("ID","NAME") , limit = 10)
Sintaxe overview: Extension functions fun ImageView.loadForUrl(url: String){ Picasso.with(context).load(url).into(this) } //single
expression sintax fun String.hello() = "Hello $this"
Sintaxe overview: When expression when(value){ is String -> print("eh String")
else -> print("n eh String") }
Sintaxe overview: Smart cast if (value is String){ print(value.length) }
Instalando plugin no Android Studio apply plugin: 'kotlin-android' android {
... sourceSets { main.java.srcDirs += 'src/main/kotlin' } ... } dependencies { ... compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" ... } buildscript { ext.kotlin_version = '1.0.1-2' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }
Referências Jake Wharton https://plus.google.com/+JakeWharton/posts/WSCoqkJ5MBj Kotlin lang docs reference https://kotlinlang.org/docs/reference Antonio
Leiva Blog http://antonioleiva.com/kotlin/ Comece agora a brincar com kotlin http://try.kotlinlang.org/