Android developers get programming extensions for Kotlin

The beta Android KTX extensions should make coding in Kotlin more concise and idiomatic

Having endorsed Kotlin as a language for Android development last year, Google is now previewing beta extensions to improve the Kotlin development experience. Called Android KTX, the extensions are designed to make writing Kotlin code more concise and idiomatic. An API layer is provided to work on top of Android’s framework and support library. KTX marks the first time Google has released a library specifically for Kotlin developers. KTX, however, is not intended to add new features to Android APIs.

Features in Android KTX

When editing SharedPreferences, which provides an interface to access and modify preference data, KTX code is shorter and more natural to read and write.

Less code also would be needed when translating the difference between two paths in an Android program.

KTX package names begin with androidx, a new prefix to be used in future versions of the support library. KTX proponents hope the division between androidx.* and android.* will make it more obvious which APIs are bundled with the platform and which are static libraries for developers working with different versions of Android. During the course of the beta period, the APIs could change. The project’s developers pledge that when KTX reaches 1.0 production status they will be rigorous and careful about maintaining API compatibility. You can offer feedback on Android KTX via an issue tracker.

Where to download Android KTX

To get started using the KTX library, download the binary file from Google’s Maven repo and add the dependency androidxcore:core-ktx:0.1 in the build.gradle file of your Android Kotlin project. To use the repo, include google() in that file. You can download the source code for the part of Android KTX that works with the Android framework from a Github repo.

CONTRIBUTION ESTI

Amsterdam is one of Europe’s leading tech-hubs. Companies are enhancing their international orientation in order to draw in talented internationals who can help them realise their projects. Esti, IT recruitment Amsterdam, attracts and retains international IT talent by guiding companies to develop a culture in which international professionals thrive. The perfect match is not only about meeting 100% of the requirements but most of all about change, progress and new experiences. Esti focusses on the personal motivation and ambition of each professional.