Anko + Kotlin + Android = The trendy combo!
Bài đăng này đã không được cập nhật trong 3 năm
A little bit about Kotlin...
Kotlin is a new buzzword in the Android development world after Google I/O '17. According to the Kotlin's official site: It's a statically typed programming language for modern multiplatform applications. Google is excited to make Kotlin as an official language for Android. Kotlin works side by side with Java & C++ on Android. Of course, you can keep your existing Java and/or C++ code as well as Android libraries with adding your Kotlin code in your Android project!
The interesting fact is that you can use Kotlin in Java, and vice-versa. Also, the Android Studio is built upon IntelliJ IDEA which is built by JetBrains & the same company created the Kotlin language. The JetBrains team has been working for years to make sure Kotlin works great with IntelliJ IDEA.
By the way, still there are so many conversations are going in-bitween Java vs Kotlin e.g. Should we learn Kotlin or stick to Java? , Should we start to use Kotlin for commercial Android Development?, Will Kotlin replace Java? You may research that Kotlin offcially states it's advantages & disadvantages compared to Java.
According to my opinion, I saw several bullet points that can take Kotlin to the next level in future. But, still most of the Android developers are using Java in their existing projects as commercial production, so it's not easy to completely give up from Java. You have to think about your other team-mates also, because if you are heading to apply Kotlin in you project, so they have to adjust with it. Besides, there are awesome communities, events, guidelines, blogs and writings on Kotlin, we can give it a try as the next official language of Android.
Intro. of Anko
Anko is a library that's associated with Kotlin which is brought to you to make Android application development faster & easier. The speciality of Anko is to write clean & readble code. According to the github repository (https://github.com/Kotlin/anko), Anko is made for supporting the following things:
- Anko Commons: It's a helper for intents, dialogs, logging etc.
- Anko Layouts: You can embed UI layouts inside the source code which is also a faster process to write dynamic Android layouts.
- Anko SQLite: It provides lots of helpers to simplify working with SQLite databases.
- Anko Coroutines: The utilities based on the
kotlinx.coroutines
library.
Kotlin offers the Anko library as a DSL(Domain Specific Language) to design an Android screen. Anko removes the unnecessary boilerplate code to write code of the layouts as clean & easy instead of XML.
So, we can use the combo (Anko+Kotlin+Android) to get a better choice in Android application development. I'm noting few links below to get start with Kotlin as well as Anko.
References
- https://github.com/Kotlin
- https://stackoverflow.com/documentation/kotlin/topics
- https://blog.jetbrains.com/kotlin/
- https://github.com/trending?l=kotlin
- https://www.toptal.com/software/kotlin-android-language
- https://medium.com/@arief_platk/no-xml-with-anko-kotlin-cdd4a187746f
- https://novemberfive.co/blog/kotlin-implementation-challenges/
- https://android.jlelse.eu/400-faster-layouts-with-anko-da17f32c45dd
All rights reserved