O'Reilly logo

Mastering Android Studio 3 by Kyle Mew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending Kotlin

As one would expect with any powerful programming paradigm, it can be extended with a plugin to increase its usefulness even further.

Every Android developer will have lost count of the number of times they have typed findViewById(). They will also be aware of how error-prone such static typing can be.

The Kotlin extension is included, by default, when Kotlin support is enabled during project setup, as can be seen in the module-level build.gradle file:

apply plugin: 'com.android.application' 
 
apply plugin: 'kotlin-android' 
 
apply plugin: 'kotlin-android-extensions' 

Using an extension also requires that it be imported into the appropriate class, usually an activity or fragment. It is more than likely that the reader will have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required