From the course: Intermediate Kotlin for Android Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Anko commons: Basics

Anko commons: Basics

From the course: Intermediate Kotlin for Android Developers

Start my 1-month free trial

Anko commons: Basics

- [Instructor] Let's see how Anko can simplify our interactions with intense and the default Android logger. It's a library so we just need to make sure we have the dependency in our build.gradle file. At the time of this recording, it's 0.10.3. And then here on line 34 you can see that it's part of the Anko commons component. Now let's start by updating our planet list activity. We want this class to use some of the Anko extension methods. So let's clean up the on click listener that's inside of our planets adapter which starts here on line 39. Right now we create an intent that contains the planet id as an extra. And you can see that here on line 42, we then provide this intent to the start activity method of the context class here on line 45. But there's a lot of boiler plate code involved. So let's see how we can achieve this goal with less code using Anko extensions. So the first thing we're going to do is comment out this code here. And then we're going to start by adding Anko…

Contents