TLDR: I would honestly HIGHLY recommend making full use of Kotlin
.
Since I do not know your exact purpose of Anko
, I will answer very generally.
Anko
was great, but now it is time to move on... Although there are several alternatives out there, Kotlin
itself is the "Best" alternative to Anko
You could make all the general helper methods from Anko
using Kotlin's Extension functions
. (read more)
Like this:
fun MutableList<Int>.swap(index1: Int, index2: Int) {
val tmp = this[index1] // 'this' corresponds to the list
this[index1] = this[index2]
this[index2] = tmp
}
val list = mutableListOf(1, 2, 3)
list.swap(0, 2) // 'this' inside 'swap()' will hold the value of 'list'
You could use the state-of-the-art async programming library called Coroutine
which Waaaaay faster than RxJava
. (read more)
fun main() = runBlocking { // this: CoroutineScope
launch { // launch a new coroutine and continue
delay(1000L) // non-blocking delay for 1 second (default time unit is ms)
println("World!") // print after delay
}
println("Hello") // main coroutine continues while a previous one is delayed
}
And much more to fulfill your needs.
Let me know if you have any questions.