Weather Changer Mod 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.


All right, hope you managed that. If you didn't, no problem at all. Let's take a look at how I would do it. First, to get rid of this error message, I'll add margins to this view. So, right here I'm going to do plus over here, make this zero, plus over here for the top, make that zero, plus over here to the right, make this a zero as well. And plus at the bottom, that margin of zero at the bottom. Okay, you see the error message is gone. Great, that's one. And for the next one to use View Binding, I'll pull up a browser tab and look for Android View Binding. 

Here we go, Android View Binding. There we go, 'View Binding/ Android Developers', click on that. Scroll down. First we have to enable this. So, right here, buildFeatures, viewBinding true. I'm going to copy this part. Go back to my code, project under Gradle Scripts. You have to go to build.gradle Module right here and in my Android block I'll paste it here, buildFeatures viewBinding true. Great. Now I have to sync this, so sync now. All right, it's synced, now I'm going to close out of this back to MainActivity. Let's see what it says to do next. 

There we go. I'm going to take this first line over here, Command-C. This is going to give me my binding variable, and I will put this inside my class on top of my onCreate method and this is going to be of type ActivityMainBinding. Remember, it's relating to my activity.main, so the class name is going to be ActivityMainBinding, right there and if I hit 'Enter' this is going to import this class for me right here, ActivityMainBinding.

All right, so let's see what it says to do next, here we go. It's setting my binding object, or variable right here, so I'm going to copy this line, go back here. After my super.onCreate, I'll paste it here, but again this is going to be ActivityMainBinding, MainBinding, whoops, pasted something additional there. All right, so now the binding is declared and here for setContentView, I'm going to set it to binding.root, and they do this in a couple of steps over here. We're doing it in one. So, now my binding object is going to be available throughout my class to use. So, within my method right here, changeWeather I'm going to replace this part findViewById. 

I'm going to get rid of it, and I'll simply say binding. there you go imageView pops up and that's it. Let's try it out. I'm going to apply changes and restart activity. All right, looks like I have to click on this reinstall and restart app. I'll do that. Process 'app' is Running. Okay, 'Terminate'. Great, it worked. Let me pull it up. There it is, click 'CHANGE ME'. Great, still working perfectly. All right, so I hope you got yours to work as well. Thanks for watching this mini solution video, and I'll see you in the next one.


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