The Android team has announced a preview of Android KTX. Android KTX is a set of extensions designed to improve the process of writing Kotlin code for Android. It does this by providing an API layer on top of the Android framework and Support Library.
Android KTX will enable developers to convert strings to URIs more naturally, according to the team. It will also be easier to edit SharedPreferences using Android KTX than it is with Kotlin. Android KTX will be more efficient at translating path differences and simplifies the process of triggering an action with View onPreDraw by several lines of code.
Currently, the part of Android KTX that supports the Android framework is available. The part that supports the Support Library will be available in an upcoming Support Library release. The team has indicated that it is waiting for the API to stabilize before this happens.
To start using Android KTX, developers will have to add a snippet of code to the app’s build.gradle file. Once the project has been synced, the extensions will automatically appear in the IDE’s auto-complete list.
A full list of features can be found on the Android KTX GitHub page.