1. Home
  2. Training Library
  3. Programming
  4. Programming Courses
  5. Introduction to Android Studio, Kotlin, and Basic App Layouts

Button Project Solution

Start course
3h 39m

This course begins by downloading Android studio - make sure you watch the appropriate video depending on whether you're on Mac or Windows. Then, we'll take a tour off the Android Studio interface and see how apps are put together. You'll learn about text views, buttons, and images to build a user interface for our app, and we'll also write some code to make our apps interactive.

Then we'll move onto a practical project in which we make a temperature converter app, which converts temperatures from Fahrenheit to Celsius. You'll be able to follow, building the app, and then running it on your system.

Intended Audience

This course is intended for beginners to Android app development or anyone who wants to master coding in Kotlin.


Since this is a beginner level course, there are no requirements, but any previous experience with coding would be beneficial.


Hello and welcome back. In this video, we'll run through the solution to the practice project that we assigned at the end of the last video. So, we'll start by creating a new Android project. Here we go, create new project. Click on, "Create New Project". I'm going to select Empty Activity. Next, name. I'm going to say, 'My Temp Converter'. All of this is fine. Kotlin, default options. Click, "Finish". Here we go. Everything is starting up. It's loading. I'm going to go to my 'MainActivity' XML file. 

I'll get rid of this. All right, increase the size. Now, I'm going to drag in a button. If you added the name in the text, that's great. But I'm not going to cover that since we did that in a previous video. Here, I'm simply going to grab a Button and drag it in here. And then, I will set a couple of the margins. I'll get rid of this, 'Hello World' TextView that was there by default. Delete. Here we have our BUTTON, and if I go to my attributes, right here, you see, I can fill in the name of the function here, but I'll show you a different way of doing this. I'll leave this empty. I'll simply go to my 'MainActivity' Kotlin file and over here, I'm going to add in the function and say, 'clickFunction()' with open and close parenthesis and within their view: View and then this will import what we need right there. View is imported.

All right. And then open and close curly braces. Now that we've done that, if we go back to activity main, you see onClick over here, if I click on the drop-down, you see I have that function that shows up. Because we've just defined it, it shows up in my options. So, I'm going to select that from here. All right. That's a different way of doing it. So, back here, I'm going to say log with a capital L. Log you see here 'android.util.Log' Alt Enter. So, it's added. 

There we go. And then do Log.i() within parentheses. I'll put in the quotes. So, for tag I'll say "Info", and then I'll put in quotes or message, I'll say "Button clicked" this time. All right. And now that we've done that, my emulator is running from before, so let me click, 'Play'. Gradle Build is running. I'll pull up my log over here. There we go. The app is starting up, there it is. Let me click on the BUTTON. Whoops, this message, Success message is blocking my view. Let's do it a few more times. There you go, Button clicked. All Right, okay, great. So, I hope you enjoyed building this mini project yourself and got some practice. Now, while we have built in some interactivity with this BUTTON, we haven't really done a whole lot. So, in the next video, we'll start working with text fields so that we can input text information in our app. See you there.


About the Author

Mashrur is a full-time programming instructor specializing in programming fundamentals, web application development, machine learning and cyber security. He has been a technology professional for over a decade and has degrees in Computer Science and Economics. His niche is building comprehensive career focused technology courses for students entering new, complex, and challenging fields in today's technology space.

Covered Topics