Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Android with Kotlin
Search
Ahmed Tarek
October 12, 2017
Programming
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android with Kotlin
Slides from my talk Android with Kotlin at Oct 2017 GDG 6 October City, Egypt.
Ahmed Tarek
October 12, 2017
Other Decks in Programming
See All in Programming
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
230
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
330
速習iPhone Duo対応
yuukiw00w
1
700
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
250
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
490
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
150
Building an Out-of-Order CPU
latte72
1
790
Family mrubyの進捗
kishima
1
130
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
430
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
430
SREの越境 / SRE Collaboration
y0hgi
2
260
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
200
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
360
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Are puppies a ranking factor?
jonoalderson
2
3.9k
The Curse of the Amulet
leimatthew05
3
15k
Abbi's Birthday
coloredviolet
4
10k
Rails Girls Zürich Keynote
gr2m
96
14k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
900
Transcript
Android with Kotlin a_tarek360 Oct, 2017
What is kotlin?
Kotlin is a Russian island
Kotlin • By JetBrains in 2011 • Open sourced in
2012 • The first officially stable release in 2016
At Google I/O 2017, Google announced..
Kotlin • Official Programming Language for Android Development
Kotlin • Statically typed programming language • 100% interoperable with
Java and Android • Avoid entire classes of errors such as null pointer exceptions.
var / val var name = "Ahmed" val id =
1 Val cannot be reassigned id = 3
Null Safety Safe var name: String name = null //
Compilation error Nullable val name: String? = null // Nullable type println(name.length()) // Compilation error println(name?.length())
Classes/Interfaces class SimpleClass class SimpleClass(value: String) interface SimpleInterface class SimpleClass
: BaseClass(), SimpleInterface
Data Class data class Car( var name: String, var color:
Int, var speed: Float) • No need to implement: toString, equals
Functions fun isMoving(speed: Int): Boolean { return speed > 0
} fun isMoving(speed: Int) = speed > 0
Companion Object class Car { companion object { fun drive()
{ } } } // Like calling a static method Car.drive()
Simple Android Activity class MainActivity : Activity() { override fun
onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val name = savedInstanceState?.getString("name") } }
Extending Language isLollipop { view.elevation = 3.0f } . .
. . inline fun isLollipop(code: () -> Unit) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { code.invoke() } }
Smart Cast fun setData(view: View) { if (view is ImageView)
{ view.setImageDrawable(drawable) } if (view is TextView) { view.setText("hello") } }
Callback/Lambda • view.setOnClickListener(object : View.OnClickListener { override fun onClick(view: View?)
{ doSomething() } }) • view.setOnClickListener { view -> doSomething(view) } • view.setOnClickListener { doSomething() }
Function Parameter Default Value fun toast(message: String) { Toast.toast(this, message,
Toast.LENGTH_LONG).show() } fun toast(message: String, duration: Int) { Toast.makeText(this, message, duration).show() } fun toast(message: String, duration: Int = Toast.LENGTH_LONG) { Toast.makeText(this, message, duration).show() }
Extension Functions fun Activity.toast(message: String, duration: Int = Toast.LENGTH_LONG) {
Toast.makeText(this, message, duration).show() } // Call it from any activity instance toast("Hello World!") toast("Hello World!", Toast.LENGTH_SHORT)
Kotlin Android Extensions <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/photo" … />
<TextView android:id="@+id/name" … /> </RelativeLayout>
Kotlin Android Extensions import kotlinx.android.synthetic.main.activity_main.* override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) photo.setImageBitmap(bitmap) name.setText("Hello World!") }
Thank You!