From the course: Android Studio Essential Training 2020

Unlock the full course today

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

Use breakpoints and watch expressions

Use breakpoints and watch expressions

From the course: Android Studio Essential Training 2020

Start my 1-month free trial

Use breakpoints and watch expressions

- [Instructor] Android Studio inherits IntelliJ IDEA's debugging system. It allows you to create breakpoints to suspend your application at any point and to inspect the state of the application internally. To set this up, I'm working with an application that I built from the basic app template. You can start with this application or with any other that has a button with a click listener. I'm going to create a new function that I'll call, loopSomething. Within the function, I'll create an ArrayList using the Kotlin function, arrayListOf. I'll set the type of the items in the Arraylist to String and I'll pass in three values of One, Two and Three. Now I want to loop through those items, I'll use a for loop. And within the for loop, I'll create a variable named i and I'll set it using the in operator and I'll start from zero until items.size. And that's like doing an iterative loop in Java, the until operator means go until…

Contents