Google helps developers clean up their code with Android KTX

Google helps developers clean up their code with Android KTX Ryan is a senior editor at TechForge Media with over a decade of experience covering the latest technology and interviewing leading industry figures. He can often be sighted at tech conferences with a strong coffee in one hand and a laptop in the other. If it's geeky, he’s probably into it. Find him on Twitter (@Gadget_Ry) or Mastodon (@gadgetry@techhub.social)


Android KTX is Google’s attempt to make writing code for their platform in Kotlin easier and more concise.

Ever since Google announced first-party support for the Kotlin programming language, many developers have been experimenting with it. As expected, when developers are getting to grips with a new language, this has led to some messy code.

Kotlin itself is designed to be friendly and easy to pick up, especially when in comparison to Java. However, that doesn’t mean there’s not room for improvement.

KTX provides an API layer on top of both Android framework and Support Library to make writing Kotlin code more natural.

In the announcement post, Google provides the following example of translating the difference between two paths by 100px in standard Kotlin vs with Android KTX:

The API is currently in preview but the portion of Android KTX that covers the Android framework is now available in Google’s GitHub repo.

What are your thoughts on Android KTX? Let us know in the comments.

View Comments
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *