Helpful Tidbits
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. In this video, we'll explore something that I've been doing at random so far, which is selecting which option to preview our app in in the emulator. These are the two options over here. See, the first one is to run app, and this shows up as just the play button if you've never run your app before. And the second one is to apply changes and restart activity. This pops up after that first run. And so far, I've been selecting them at random to come up with different scenarios for you to see. Sometimes the terminate app process, pop up, shows up and sometimes it's quick, sometimes slow. So, what exactly is going on over here? Now that we've made and run a few basic apps, let's explore what these are and some of the differences. 

First, we're going to start with a run app right here . When you run this option, this builds an APK, which stands for android package and launches the default project activity. So, basically, it will apply all of your changes that you've made and restart  and redeploy the whole app. So here, when you look at the emulator, this screen will disappear and a new app screen will start. And in terms of process, think of running this app on this emulator as a process. This would restart the whole process. That's why we get the pop up every now and then that says that an app is already running, do you want to terminate it? So, let's look at this example over here. I'll make a change and hit run app. 

See what happens. And I'm going to change this Hello World to something else, all right, so right here and you see the text Hello world. I'll change it to Hello Mashrur. And let's run our app and see what happens. I'll select this first option, run app. You see the apps restarting from scratch; it went away from the screen. It's installing everything, creating the new package, and there you go. Hello Mashrur, all right? Now, let's try with apply changes and restart activity. I'll make the same change again. Over here, I'll say hello again Mashrur, hit 'Enter', and then Apply Changes and Restart Activity. So, this one simply applies the changes that you've made and pushes it to your running app. 

So, if you have an emulator that has your app running through a process already, it didn't get rid of the app from the screen, it simply updated the text. So, basically, it will apply the changes to the existing process that's running. And this option will work pretty frequently unless it runs into issues and a restart of the app process will be necessary, at which point it will prompt you to install updates and run again, which would be the same as running the app from scratch. So, let 's take a look at that example and see if we can recreate it. I'll use another process of updating the string right here. You see this text string. Right here we have this message and it says hard coded text, and it's trying to discourage us from doing this. It's basically saying declare a string and use it. Right now, if I go here and click on this, you see under string, I have just an app name. Where is this coming from? 

And how do I get other options here, other strings here to show up that I can use? Well, I can do it this way, I'll cancel this one. Here, I'll pull up my projects under res  for resources under values you see strings.xml. Pull this up. Right now, you see it has the app name, the temp converter, which is what we see here. So, to add a string here, let's say we want to add a greeting message. I'll click on 'Open editor' and click on this '+' key. I'll say greeting_message, and default value, I'll say welcome to the temp converter, okay? Now I have this additional string that's here. So, I'll close out of translations editor. And you see it's been added here. You can add this as code here as well instead of opening the editor, but I prefer to do it through the editor when possible. 

So, back here, now I'll make some space, get rid of the Projects tab. All right, so here now instead of Hello again Mashrur, if I click on this, check it out, greeting message shows up. I'll click on this. Okay, now, you see welcome to the temp converter, and you see that error is gone, right? That's informational error, it's gone. So, now if I apply changes and restart activity, let's see what happens. You see this time it gave me an issue, it's saying added variable, not supported value initialization. Basically, it's saying that I needed to run app. It's saying reinstall and restart app. So, I can click on this. Essentially, it's doing the same thing as restarting the app. See it disappears and then the new apps going to start. 

So, basically, you can click on 'Apply changes', restart activity, and if it runs into any issues. It will just restart and walk you through it. There you go. Welcome to the temp converter. Now, one thing to keep in mind is that this only applies to the activity, right? Apply changes and restart activity. It's not going to restart your whole app. So, whatever is included in the activity, the changes will be reflected. However, you see on top here the temp converter, that's the name of your app. What if you change that? So, I'll pull up my strings again right here. See app_name. I'll open editor. I'll select app_name and you see key is app name, default value Temp converter. 

What if I change it to my temp converter? You see my temp converter, that's great and I'll close out of here. You see it's been converted to My Temp converter. Now, if I apply changes and restart activity, you see it's saying success; operations succeeded. Welcome to the temp converter, the activity. See? Nothing changed, so it's fine, but the name didn't change. That's because my app is still running; it's not a change to the activity, but the name of the app itself, right? So, for this change to be reflected, I'm going to need to run my app again. So, if I select run app, let's see what happens. See, now it's saying process app is running, we want to terminate the process app, yep, terminate the existing one and it will launch a new process. 

So, a new one is going to start up and this should say My Temp Converter. There you go. The name of the app has changed and it's reflecting correctly. Okay, so hope that sheds some light into the differences in the two options. Also, you see this stop button, you can stop your running app by selecting this if you choose to. I can do that and my app stops. And once that happens, you see that option to apply changes. Restart activity gets disabled because now my app isn't running so I have to run my app from scratch. All right, so hope the differences between these two options are a little more clearer now and you found this video helpful. Thanks for watching, and I'll see you in the next video.


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