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 por onde começar?
Search
José Caique Oliveira
July 08, 2017
Programming
100
1
Share
Kotlin por onde começar?
Como começar no Kotlin para Android
José Caique Oliveira
July 08, 2017
More Decks by José Caique Oliveira
See All by José Caique Oliveira
Kotlin Flow
jcaiqueoliveira
0
140
Coroutines And Flow
jcaiqueoliveira
2
120
Testing your app
jcaiqueoliveira
0
310
Modularizando seu app
jcaiqueoliveira
0
75
Nova Api de Localização Android
jcaiqueoliveira
0
99
Arquitetura para android
jcaiqueoliveira
6
320
Introdução ao Android
jcaiqueoliveira
1
94
Arquitetura para projetos Android
jcaiqueoliveira
1
240
Kotlin 1.1
jcaiqueoliveira
0
140
Other Decks in Programming
See All in Programming
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
180
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
290
「速くなった気がする」をデータで疑う
senleaf24
0
150
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
760
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
390
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
990
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
250
KagglerがMixSeekを触ってみた
morim
0
370
Rethinking API Platform Filters
vinceamstoutz
0
11k
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
220
へんな働き方
yusukebe
6
2.9k
まかせられるPM・まかせられないPM / DevTech GUILD Meetup
yusukemukoyama
0
110
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Producing Creativity
orderedlist
PRO
348
40k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Building an army of robots
kneath
306
46k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
240
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
The Cult of Friendly URLs
andyhume
79
6.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Thoughts on Productivity
jonyablonski
76
5.1k
Transcript
Kotlin por onde começar Caique Oliveira
val e var val nome : String = “Caique” nome
= “José” (erro) var nome1 : String = “Caique” nome1 = “Oliveira” https://goo.gl/Uef9D2
Criando um objeto class Client { } val client =
Client() https://goo.gl/1bqnX S
Kotlin é null safety cpf?.removeNonNumeric() cpf!!.removeNonNumeric() https://goo.gl/Dz47kY
Construtor no Kotlin Class Client constructor(var name: String, var city
: String) { fun printName(){ print(name) } } https://goo.gl/KFcmnV
Data class - Classes para a representação de dados data
class User(val name: String,val age: Int) https://goo.gl/DRxvPy
Criando funções com o Kotlin fun double(value: Int) : Int
{ return value * 2 } fun sum(a: Int,b : Int = 0){ return a + b } sum(1) sum(2,3) https://goo.gl/TZdf2Y
Lambdas - remove boilerplate - simplifica código button.setOnClickListener{ Toast.makeText(activity,”Olá”,Toast.LENGTH_LONG).show() }
https://goo.gl/PDbLtq
for for ( i in 0 .. 2 ) {
} for(client : Client in clients) { } https://goo.gl/fYZNNU
with with(recyclerView){ setHasFixedSize(true) layoutManager = LinearLayoutManager(activity) } https://goo.gl/PLV6fY
when when(view.id){ R.id.button1 -> { } R.id.button2 -> { }
} https://goo.gl/r5hHqX
apply - possui como referência o this dialog?.apply{ this.dismiss() }
https://goo.gl/RJzPp9
let - possui como referência o it dialog?.apply{ it.dismiss() }
https://goo.gl/VS1hWE
run - chama um bloco de código e retorna um
resultado dialog?.run{ isVisible } https://goo.gl/ChNq4d
Extensions - Possível adicionar novos comportamentos a uma classe fun
View.visible() { visibility = View.VISIBLE } antes imageView.visibility = View.VISIBLE depois imageView.visible() https://goo.gl/N4isRx
Kotlin- Extensions: Adeus findViewById adicionar ao cabeçalho do gradle: apply
plugin: ‘kotlin-android-extensions’ antes val button = findViewById(R.id.button) as Button button.setOnClickListener{ } depois //val button = findViewById(R.id.button) as Button button.setOnClickListener{ } https://goo.gl/kx1GXJ
Graduado em Ciência da computação - UFS Android Developer -
Stone Pagamentos
[email protected]
@jc_hobbit Caique Oliveira