Anko – The Ultimate Ninja of Kotlin Libraries?
Kotlin is a new language for the JVM that aims to be a “better Java”. Made in-house by Jetbrains, the company behind IntelliJ IDEA and also Android Studio, it’s been in development for more than 5 years. Just a few weeks ago the final version of Kotlin 1.0 saw the light of day.
The language itself gives one so much niceness and syntactic sugar that you’d probably never want to go back to coding in Java again. Things get even better with Anko. Anko is pretty much the ultimate Ninja of Kotlin libraries. The feature it’s best know for is its Layout DSL that allows one to programatically write UI code in Kotlin. No more XML layout and no awkward piecing together of your UI through clunky Java APIs. We will look at how to use and how to extend the Layout DSL for your own requirements and then move on to Anko’s advanced, non-layout-related features:
- Intent wrappers
- Shortcuts to system services
- Asynchronous task management
- Anko SQLite and more