Image for post
Image for post

Making Kotlin easier 😲 (Android development)

You are probably thinking impossible. Come on Kotlin is like cakewalk! How could it be any simpler? Well, Haaaaave you met Anko?

dependencies {
compile "org.jetbrains.anko:anko-commons:$anko_version"
}
alert("Hi, I'm Rashi", "Do you find my posts helpful?") {
yesButton { toast("Thanks, will start writing more :)") }
noButton {
toast("Alright, let's start working on improvements") }
}
.show()
Image for post
Image for post
Image for post
Image for post
alert {
title
= "Hi, Its Rashi again"
positiveButton("Cool") { toast("Yay :D") }
customView {
verticalLayout {
textView("Follow me for posts on tech, design and spirituality.")
button{
text = "I'm in!"
onClick {
info{"thanks for following"}
}
}
padding = dip(16)
}
}
}
.show()
// Anko Layouts
compile "org.jetbrains.anko:anko-sdk25:$anko_version"
compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"

// Coroutine listeners for Anko Layouts
compile "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
compile "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
Image for post
Image for post

Author of Kotlin Programming Cookbook | Android Developer | www.rashikaranpuria.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store