From the course: Intermediate Kotlin for Android Developers
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Kotlin Android Extensions advanced
From the course: Intermediate Kotlin for Android Developers
Kotlin Android Extensions advanced
- [Instructor] Checking out the recompiled Java code of your kotlin classes will help you get a better understanding of what's happening behind the scenes. Lets take a look at the code for our Planet List activity class to see how Kotlin Android extensions work. So we're going to use a quick action and we're going to go to kotlin bi code. And then we're going to click on decompile so that it's easier to follow. So the first thing that you notice as we scroll down is that the planet list activity now has this view cache which is just a hash map. So whenever we want to find elements of our view this find cached view by ID method is executed. So if we navigate to it, we notice the first thing it tries to do is create the hash map if it's empty. Otherwise it looks into the hash map to get the view and if it can't find it, then it does Androids find view by ID lookup and stores it inside of the hash map. So this is just a really nice experience when working with our code because we know…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.