Tuesday, January 24, 2017

Kotlin Techniques that Improve Your Android Code

Kotlin is a general purpose language. It compiles to Java bytecode. Kotlin is developed by the company JetBrains which makes IntelliJ IDE. This article covers techniques which make writing Android code in Kotlin efficient or easy. You can find the code for this article at GitHub

Using Static layout imports in Kotlin

One of the pain points of working with Android is when we want to use one of the views in the activity. We have to use the ‘findViewById()’ function and then type cast it to the appropriate view type. Kotlin takes a different approach: it lets you import all the views in your layout file. For example, suppose we have a layout file as below

Continue reading %Kotlin Techniques that Improve Your Android Code%


by Abbas Suterwala via SitePoint

No comments:

Post a Comment