From the course: Intermediate Kotlin for Android Developers

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Benefits of Kotlin on Android

Benefits of Kotlin on Android

From the course: Intermediate Kotlin for Android Developers

Start my 1-month free trial

Benefits of Kotlin on Android

- [Instructor] The introduction of null into programing languages has been called the billion dollar mistake. This is becuase it has led to endless errors and crashes over the past several decades. Kotlin's type system aims to address this issue by putting null ability front and center. The Kotlin compiler enforces that variables that cannot hold null values will cause a compilation error if you attempt to set them to null. Just like what we see here. Conversely, if you explicitly declare that the variable can be nullable, you're good to go. This can prevent you from experiencing the dreaded null pointer exceptions that Android is notoriously known for. Kotlin also helps with readability in your Android code. Android tends to make liberal use of callbacks or listeners. Here's an example of setting a ClickListener on a FloatingActionButton in Java. And here it is again in Kotlin. Much more concise, and easier to read. Another very common issue on Android is having methods with too many…

Contents