What is KTX (kotlin extension library) and why is it becoming more and more popular in Android development

How to start with KTX for Android?

resolvent:

Android KTX - a set of extensions designed to make Android kotlin code writing more concise, idiomatic and pleasant. Android KTX provides a good API layer on the Android framework and support library to make your kotlin code writing more natural

For example,

Parsing string to URI in kotlin (traditional way)

We are

val uri = Uri.parse(myUriString)

By using KTX, we can simplify the above code

val uri = myUriString.toUri()

You can refer to this blog for more details

https://android-developers.googleblog.com/2018/02/introducing-android-ktx-even-sweeter.html?m=1

Because there are few boiler board codes, I think it will become more and more popular

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>