Google releases preview of Android KTX for Android that is as per google - “more concise, idiomatic, and pleasant.”

Android Kotlin extensions uses package names that begin with androidx. Kotlin extensions helps developers to write shorter and cleaner code. 

An examples of how Android KTX can help developers write more natural and concise Kotlin code.

Translating path difference

In the code below, we translate the difference between two paths by 100px.

Kotlin with Android KTX
val pathDifference = Path(myPath1).apply {
   op(myPath2, Path.Op.DIFFERENCE)

val myPaint = Paint()

canvas.apply {
   val checkpoint = save()
   translate(0F, 100F)
   drawPath(pathDifference, myPaint)

val pathDifference = myPath1 - myPath2

canvas.withTranslation(y = 100F) {
   drawPath(pathDifference, myPaint)

Read more about the features on its blog and the android KTX that covers the Android framework is available on GitHub.