Android KTX - Kotlin Extensions
Android KTX - Kotlin Extensions
Written by Mike James   
Wednesday, 07 February 2018

Google has just announced Android KTX, a library of Kotlin extensions that are designed to make Android easier to program using the latest first class Android Language. It at least reveals how serious Google is about Kotlin for Android.

kotlinlogo

KTX is a strange beast. It isn't part of the Android Framework and it has to be included as a separate library to make use of it.:

"Today, we are announcing the preview of Android KTX - a set of extensions designed to make writing Kotlin code for Android more concise, idiomatic, and pleasant. Android KTX provides a nice API layer on top of both Android framework and Support Library to make writing your Kotlin code more natural."

It isn't being released as production quality code as yet, but given its nature it seems safe enough to try it out. If an extension isn't doing what you want you can simply drop back to the Framework. The only warning is that, given it is a preview, it could change.

The team is so keen on Kotlin that they have produced a video and called it Introducing Android KTX: Even Sweeter Kotlin Development for Android:

 

 

The final "Kotlin is here to stay and we have big plans for it" is quite an eye opener if you are planning to stay with Java.

It is true that most of the extensions are simply syntactic sugar and yes you could dismiss them on these grounds, but they do make programming easier.  Many of the changes could have been made directly to the Framework rather than as extensions but extensions mean you can take it or leave it.

KTX also introduces the androidx namespace:

"This is a new package name prefix that we will be using in future versions of Android Support Library. We hope the division between android.* and androidx.* makes it more obvious which APIs are bundled with the platform, and which are static libraries for app developers that work across different versions of Android."

It also raises the question of how much overhead is involved in using KTX, both in terms of the included libraries and the extensions as static methods.

It is interesting to see how many of the improvements could have been added to Java with a little more effort and Java 8 support.  What is certain is that the Android team seems to love Kotlin and this probably means that Java is going to get less attention in the future.

 

Mike James is the author of Android Programming In Kotlin: Starting with an App and The Programmer's Guide To Kotlin

 

coverKotlinsmall

cover

 

More Information

Introducing Android KTX: Even Sweeter Kotlin Development for Android

Related Articles

Android Programming In Kotlin: Layouts and Autonaming Components

The Programmers Guide To Kotlin - Iterators, Sequences & Ranges

Kotlin Begins Its Takeover Of Android

The Future Development Of Kotlin

Kotlin - New Language For Android

Kotlin - another Java alternative?

kotlinAndroid

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin.

 

Banner


Open Source Celebrates 20 Years
02/02/2018

The 20th anniversary of Open Source Software is being celebrated on February 3rd at FOSDEM, taking place in Brussels, Belgium. A new website has been launched by the Open Source Initiative in connecti [ ... ]



MongoDB Finds Devs Held Back By Maintenance and Admin
07/02/2018

Research commissioned by MongoDB has revealed that while developers are recognised as the key drivers of enterprise innovation they are so heavily burdened with upkeep of infrastructure that their tal [ ... ]


More News

 
 

 

blog comments powered by Disqus

 

Last Updated ( Wednesday, 07 February 2018 )
 
 

   
Banner
Banner
RSS feed of news items only
I Programmer News
Copyright © 2018 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.