January 2018
Intermediate to advanced
434 pages
14h 1m
English
Anko hides all the complexity and gives you an easy-to-use function to achieve complex things. Let's check out the implementation of the selector function:
fun Context.selector( title: CharSequence? = null, items: List<CharSequence>, onClick: (DialogInterface, Int) -> Unit) { with(AndroidAlertBuilder(this)) { if (title != null) { this.title = title } items(items, onClick) show() }}
As you can see, beneath the surface, it's just like the old way, but Anko provides syntactic sugar, which helps us achieve the same thing with less code.
Read now
Unlock full access