What is Anko?

6

Since converting my Android projects to Kotlin, in some research that I have been doing, they quoted several times by Anko Kotlin.

What is this guy from Anko? What it is? What is your goal?

    
asked by anonymous 10.08.2017 / 06:20

2 answers

6

According to the GitHub of it is a library to facilitate development for Android with mechanisms for Intents, Dialogs and toasts, Logging , Resources and dimensions and still corotinas, a deficiency of Kotlin.

It also has a DSL for layouts . Example:

verticalLayout {
    val name = editText()
    button("Say Hello") {
        onClick { toast("Hello, ${name.text}!") }
    }
}

This is syntax Kotlin. Why use XML? :)

You have a facilitator for retrieving data from SQLite. Example:

fun getUsers(db: ManagedSQLiteOpenHelper): List<User> = db.use {
    db.select("Users")
            .whereSimple("family_name = ?", "John")
            .doExec()
            .parseList(UserParser)
}
    
10.08.2017 / 13:31
7

It's a library for Kotlin specifically aimed at developing Android applications, with the goal of making the code simpler and more readable, thus requiring the developer not to get involved with the deeper details of the Android SDK for Java.

>

You can find a more detailed description with examples in: link

    
10.08.2017 / 08:26