From the course: Programming for Non-Programmers: Android & Kotlin

Unlock the full course today

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

Connect visual objects to variables

Connect visual objects to variables

From the course: Programming for Non-Programmers: Android & Kotlin

Start my 1-month free trial

Connect visual objects to variables

- Up to this point, we've had some practice writing variables in our code, but we haven't done anything with them yet. In other words, we haven't had some kind of way of checking their values. So let's take a look at how that works, by putting the value of a variable inside of a text field. So, I'm working in a new project, and I'm in my Cutland file right now. I'm going to head over to my user interface file, which is activity_main.xml. If you don't have this file open, you can go inside of the project window, and navigate to app, res, layout, and you should see it in there. Activity_main.xml. So I'll close the project window and if you're familiar with xml at all, you may know that it's a text-based format. If you go to the bottom of Android Studio with this file selected, you'll see that there's the design view and the text view. So behind the scenes, this xml file actually is just powered by plain text. Let's go back to the design view. And what we want to do is associate this…

Contents