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
1
90
Kotlin por onde começar?
Como começar no Kotlin para Android
José Caique Oliveira
July 08, 2017
Tweet
Share
More Decks by José Caique Oliveira
See All by José Caique Oliveira
Kotlin Flow
jcaiqueoliveira
0
110
Coroutines And Flow
jcaiqueoliveira
2
110
Testing your app
jcaiqueoliveira
0
290
Modularizando seu app
jcaiqueoliveira
0
71
Nova Api de Localização Android
jcaiqueoliveira
0
83
Arquitetura para android
jcaiqueoliveira
6
320
Introdução ao Android
jcaiqueoliveira
1
81
Arquitetura para projetos Android
jcaiqueoliveira
1
230
Kotlin 1.1
jcaiqueoliveira
0
130
Other Decks in Programming
See All in Programming
概念モデル→論理モデルで気をつけていること
sunnyone
2
250
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
AI時代のUIはどこへ行く?
yusukebe
18
8.9k
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
280
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.5k
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
1.5k
Navigating Dependency Injection with Metro
zacsweers
3
960
GitHubとGitLabとAWS CodePipelineでCI/CDを組み比べてみた
satoshi256kbyte
4
240
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
180
機能追加とリーダー業務の類似性
rinchoku
2
1.3k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
380
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
600
Featured
See All Featured
Scaling GitHub
holman
463
140k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
The Cost Of JavaScript in 2023
addyosmani
53
8.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Code Review Best Practice
trishagee
70
19k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Making Projects Easy
brettharned
117
6.4k
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Done Done
chrislema
185
16k
Music & Morning Musume
bryan
46
6.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
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