Create Your First Android App | Grant Klimaytys | Skillshare

Create Your First Android App

Grant Klimaytys, Software Engineer

Create Your First Android App

Grant Klimaytys, Software Engineer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
7 Lessons (23m)
    • 1. Introduction

    • 2. Get Setup

    • 3. Running Your First App

    • 4. Create Our User Interface

    • 5. Connect Code to View on Android

    • 6. The Class Project

    • 7. Solution to the Class Project

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

*** Create Your Very First Android App ***

Together, we will create a counter app running on Android!

This mini course shows you all the absolute essentials you need to get going with Kotlin programming and Android apps. No messing about with big words, just pure app creation action!


No other course takes you from beginner (with no experience) to a working Android app in less time than it takes to make a sandwich! I will show you how to:

  • Install Android Studio (and required extras)
  • Setup the graphical look of your app
  • Connect layout elements like buttons and Text Fields to your Kotlin code 
  • Code in Kotlin within an Android activity

This course is for you if you:

  • Are a beginner or novice to Android App development
  • Want to understand Android apps in a short period of time
  • Love proceeding at a wickedly fast pace!

This course is not for you if:

  • You are an expert or intermediate developer

What software do you need?

  • Android Studio (free) which runs on PC / Mac / Linux

Do you need experience?

  • No. I assume you are a complete beginner to apps and development in general

What makes this course different?

It's just so quick! Take i right now and you'll learn Android apps before you can even blink! Everyone used to tell me apps were hard to make - but they're wrong. It's probably because they had bad teachers - join me and I'll show you what good teaching is!

Upload to gallery

Once you're done I want you to GO NUTS with the colors! Upload your craziest designs to the project gallery!

*** ENROL in this class now and see how easy Android apps can be! ***


Meet Your Teacher

Teacher Profile Image

Grant Klimaytys

Software Engineer


My very first software program was the artificial intelligence brain of an underwater robot in the early 2000's, still the coolest project I have ever worked on!

Since then I have designed and built websites, software and apps using all manner of languages and frameworks. Javascript, Bootstrap, .Net, Python, PHP - you name it, I've probably used it.

These days I focus on building quality cross platform apps using Xamarin studio in C#, Xcode and Swift 2 and Android Studio.

If you're considering becoming a freelance developer then I can honestly say it is the best life in the world. You will have no boss, earn an hourly rate of $60 - $150 and take holiday whenever you want!

Of course you have to learn how to make good apps first, which brings me to my second pa... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Introduction: Hello and welcome to this really short sharp and to the point course on how to make your very first Android app if you've never coded before. This course is for you. If you have coded but never coded in Android before, or Katlyn, then this course is for you, but it might be a little slow going because I do explain everything as we go. What you can see on screen is what we're going to make a very basic app that allows us to count things. We're going to add one and keep adding one every time we tap this button and subtract one every time we tap the low button. So for the first part of this course, I'm going to run you through how we create the addition part of this button and that text that we see on screen. And then the class project is going to be for you to create the subtract button and all the logic that goes behind it. I do, of course give you the solution, but I want you to have a go because we learn best by doing the two files we'll be working with in our Android Studio project are the main activity and the activity main.xml, which does all of the graphical user interface for us. Those are the two basic files I'm gonna take you right from the beginning, even if you don't have Android Studio installed, all the way up to creating your first fully-fledged counting app. So it's time to begin. But before we begin, if this course really helps you out and you find it really useful, then please do leave a like, please leave a comment and tell me what you think about it. Also, tell me what else you'd like to see where you'd like to go from here. Alright, let's begin. 2. Get Setup: The very first thing we need to do is of course, get the tools that we need to build Android apps. And in our particular case, and in a 100% of everyone else's cases, it's Android studio. So just jump into Google, search for Android Studio. Click the first link that you see if it's odd on the domain And go ahead and download it and let it install. It will take well, it'll ask for a bunch of prompts, just agree to most things, and then you should be good to go. Once you've installed it, we can then fire it up. Now Android Studio is quite a big and bloated program, as you probably understand, because it has to do a lot of things. So it can take awhile to load up. Sometimes, even if you have a fast PC like I do. Okay, so that is Android Studio load is, now you won't see this screen because this screen is an app that I'm currently working on for a course. But if you go to File New, We can go to file new projects that we go. And we can go ahead and create our own project. What we're gonna do is create an empty activity, which is this third 1, fourth 1 along here. So there are lots of different options that you can start with depending on what you want to make. But seeing as this is our very first step, we're just going to click next on that. We're going to call it whatever we're going to call it, we'll just leave it at my application and we're going to store it. Wherever we're going to store it. We're going to write in Katlyn and not Java, because Scotland is a lot easier to learn than Java. And the minimum SDK's the minimum device that you're going to run on. So we're going to leave this at API 26 or Android eight. When we hit finish, is going to go ahead and create all of the necessary files for us so we're ready to code. 3. Running Your First App: Now that we've created our project, you should get this file opened up automatically called main activity dot KT. Kt is the file extension for Katlyn coding. You'll also get this file opened up activity underscore main.xml. This basically contains the view of our app. And our particular app just has a single view with a text view inside it with helloworld written there in the middle. Okay, so what the main activity does is it basically initializes everything. It goes and grabs this particular XML because we tell it to do it in this line where we say setContentView, R-dot layout dot activity main. And what that stands for is that we are in the res folder, which is over on the left-hand side here, layout activity main. So all this is really is a directory address. We're looking for the item that we're actually going to show on screen. This is contained within a, what we call a function, which is to create the activity. And that function expects to receive a view which has upset is the activity underscore main.xml. So that's all that is doing. Now if we want to see what this looks like within an app, we need to go first of all, to tools and AVD Manager. If you haven't already done this in the AVD Manager down at the bottom, you can click Create Virtual Device. Go ahead, run through all those steps to create an Android device. This is where we set up our emulators. I already have some emulators running, so I can choose, for example, a pixel three. And when I click play on this, it's going to go ahead compile the app's code, which means translated to something that's readable by the Android device that we're going to run on. It's going to load the Android device, like you can see here. And then we'll see what the app looks like. There we are. Our app is running on the device. It has a bit of text called Hello World. So let's look at what happens if we go back to our code and we open this activity main.xml, if you go to the helloworld section there and to zoom in, just hold down the Control button and roll the mouse wheel. And if you double-click it, sometimes you can edit it, sometimes you can't. Android Studio can be a bit funny like that. But if you click it once over on the right-hand side, we get access to all of that items properties. This is called a TextView because it's a view that shows text. And down here we have this text section that says hello world. Let's have hello. You instead press Enter, so it sticks and then hit control S to save or command S if you're on Mac. And now if we hit this little icon at the top here that says Run app or shift f ten. That is going to load the app. Once again, removing the old app and load it back in. It doesn't remove the old apps data, but it does replace the code. So now we have our text on screen. Hello you. So they go, Congratulations, you've just run your first app and you've replaced the text, change the texts, you've changed the view within only a couple of minutes. 4. Create Our User Interface: So we have a basic app, but now we actually need to do something with the app. So what we're gonna do is we're gonna modify the app, so it becomes a counter app. And what we're gonna do, the elements that will be involved in that is this bit of TextView here. So we're going to change this text first of all to the number 0. So it just says 0. We can actually click that and make it larger under the text appearance section. So we have large here, which is fairly large. We can also set things, we can give things custom fonts families, we can give them custom text sizes. So we can draw, bring this all way up to 36. And if we zoom out, you can see that that is pretty basic. So let's actually pumped this all the way up to 56, something nice and bake. With apps. It really helps to be big and obvious whenever you uploading them to the App Store. Because the screenshots let the user know what's going on before they clicked download the screenshots or like an advert for your app. So I always advise that your UIs you'll use the interfaces are big, bold, and bright, and most importantly, different from everyone else on the App Store. Kay, cuz people like different and they will click when they see it, right? So we have our texts there. That is what we call constrained. Inside the view. These little springing things you see at the sides are constraining it to the view. Now let's understand what that means by putting a button in here. So over on the left side you have this menu called the pellet menu. We click and drag a button down here. And I'm just going to drop it red just somewhere below the 0. It won't actually be fixed at that point because it has no constraints, so it doesn't know where it needs to sit. But if I zoom in and I click on these items here, these little handles, and then I click on another one. What it does is constrain it to that second one. So now if I try to move the button away, See how this really faint line that links the two. Okay? And now I can kind of move this around. And if I do that, the constraint changes its distance. So what we're gonna do next is click and drag from the side to the side of our particular screen, and then take the other side to the left side and you see this little spring pop-up. And when you do that, Android Studio kind of knows that you want to position this in the middle. Now you can give both of those things different weights. But at the moment, if you look at the right side, we have 0040 up to the top. So 00 simply mean you wanted to calculate it automatically, which it's going to do. So now this button is more or less constrained in its view. You'll notice there are a couple of warning triangles over on the left here. And it said hard-coded strings. We don't have to worry about that. And we've got hard-coded text. So as long as we have no warnings about the constraints, then we're good to go. In that respect. Now the button itself, of course, has properties. So if we click it and scroll down, we can give the text on the button text that we want to actually give it. So Let's have add one. Now you can probably guess what's going to happen every time you tap the button to add one, that 0 is going to increase. And how do we do that while we do that next time in the code? So make sure that if you're following along, but your user interface looks like this. First of all, also, if you feel like it, you can click the button and you can change colors, just go nuts, mess around with the background tent. We can have things like colors like that. We can set the background to drawables. We can have the tint mode. There's so many things you can play with. Just have a scroll, you know, select Bold, select italic, put it in the center, which already is, put it at the side. So many options that we can play with. So this is all part of learning if you're new to coding on Android or any system, just go nuts. Go and press a lot of stuff until you get the look that you want. The look that I want for this particular button is I think I'm going to change the width to something like 60 DP. And perhaps a bit bigger than that. Let's try 160. And I'm going to change the height to 60. Okay, now it's a big obvious button and I like big obvious things on my particular apps. Now, what did I just do them when I hit the width and the height, I, I specified it was Dp, which stands for device pixels or device independent pixels. We use to operate just in pixels. But the problem was when high resolution screens came along, you would get two pixels in the place of one pixel before. And the two pixels together will be the same size as one pixel from before. So Android came up with this system where they have a device independent pixels. So you just put 16T in there and it comes out as a 160 pixels. And Android does all the work behind the scenes, making sure that it comes out as the same size on different devices with different pixel densities. There was a time when you had to do all of this stuff manually and it was a right pain. But now those times her over. So this is a good time to be learning Android because, well, it was a right pain. Anyway, that's it for now. Next time, we're gonna do some code. 5. Connect Code to View on Android: So we have our user interface setup in our activity main XML. We have a button and we have a TextView. Every time we click the button, we want to add one to our TextView. So how do we go about doing that? Well, what we're gonna do is go over to our main activity. And up at the top here, underneath the class section, we are going to add a variable called count, which is of type integer equal to 0. Now if you're new to programming, all I've done here is create a space in my memory, literally the memory in our computer that Rahm, I've given it a name. This is for us as humans because we are, the computers don't work by names. They work by identifies like numbers and letters, which is what's in a name. But they don't use these names like this. They're actually hexadecimal strings, I believe, or, or addresses in memory. And we're telling it as an integer, and integer is simply a whole number, 012, etc. Okay, so that's all we've done there. We've created an integer 0. This is going to keep track of what number we currently on. And then it's also going to allow us to assign that number to the text view. Okay, so in onCreate, we've set our content view. What do we have to do next? Well, we need to actually get a handle on the button because our activity is loading this activity_main file. It's becomes aware of all of the things inside of the file. So it knows there's a button and it knows as a TextView. If we click the button, you'll notice up here, there's an ID on the right-hand side that says button. If you click the text view, we have an ID called TextView. That is how we access these items in the code in main activity dot Katlyn or anywhere else such as fragments, as you get more advanced in Android. So if I start typing button in this onCreate, you'll notice that it picks it up for us. It says, oh, I know there is a button in activity main and activity_main is relevant to this particular file. Now sometimes Android Studio can pick up things from other XML files. So be very careful when you select things because it can be the cause of crashes. If we type a period character, a full stop, it gives us all the things that button can do. Claire animation, start animation accessibility. There are so, so many things. What we need is a way to listen. When it's clicked. Ie, we want to be notified when someone taps it. And in Android, this is the set on click listener. So if we scroll up, we will see it eventually. There it is. So we want that second one with the two curly braces and Mary press enter, it fills it for us. Press enter again, it drops down. And you'll notice on the right side we have this very pale text that says IT view. That's because whenever the button gets clicked, the code in the background in Android passes us over a reference to the button that says, here's the thing that was clicked. Do what you will. In this particular case, we don't have to do anything. But if we wanted to, we could change the text on the button to say cliques. Or we could even have the counting inside the button. And using this IT view is the way we would get it, but we're not doing that right now. What we're going to do is grab our count. And we're going to have plus equals one. That's shorthand for saying add one to count, right? Normally. Or back in the old days we would say count is equal to count plus one. But that's a bit verbose and you'll notice we get a little error. If we click the error, it says replaced with this. So that's what we're gonna do. So that's going to add one to the count. How do we show the user this count? Well, remember, we can access the TextView. So if we start typing it, it pops up and then we can type text. Now this allows us to set the text in the text view. We assign an equals to it. And we say I want this text to be count. Now a little red error comes up. And why is that? Well, if we hover over it, we get a type mismatch required, a char sequence, found an integer. All that's saying is that the text needs to be, basically that it needs to be text a string. Character. String is just a combination of characters. So that's a string, that's a string, that's a string. My name is a string, but this is a number. So it doesn't like to assign a number to a string. What we can do is change this to a string. There we go, simple as that. Now, this is called a type conversion. We're converting from a number into a string. It's perfectly alright today. For this particular case, if I was going to run this, if I was going to try to change a string to an integer, I'd have to be very careful. But you'll learn that in your career as you develop, right? So I've run it now in the simulator. And when I tap this, everything changes. And every time I tap it, we get an extra change in our numbers. And of course this is going to continue ad infinitum. So grand graduations in just what's that 12344 lines of code. A couple of clicks. You've already, already created your very first interactive Android app. It really is that simple. 6. The Class Project: Right, so it is time for the class project. And this one is fairly straightforward because you've done every single element that I'm going to assign to you. We have a button to add one. We need a second button that subtracts one. So I'd like you to create a bus and drop it into this view. Hook it all up in the code in your file. And whenever you tap it, it removes one from the displayed total. So have a go at that pause the course now, see you can have a propagated because you learn best by doing rather than watching. Once you've had a go, come back and I'll give you the solution. 7. Solution to the Class Project: How did you find that projects? If you had to go back and look at the lessons that I did with you previously. That of course, is fine. You can feel free to do that whilst you're still learning. Even I, as a pro developer, go back and look up code because you just forget this stuff, even the basic stuff, it's perfectly normal, right? So let's grab a button. And what we can do is drag another button in here. Or I can go down to this button, I can right-click copy. And I can press control V to paste it. And it's gonna paste it in the same spot with the same constraints. Now we don't want the same constraints obviously because we don't want the buttons to cover each other up. What I'm gonna do here is right-click the constraint and Clear Constraints of selection. So everything is now gone. So we can run through the constraining process again. Come on, Erica. And we can constrain it to the upper button and then drag it down. We'll just give them a bit of separation like that. I am going to change the color of this button to something. Actually, i'm going to change the color of that button to read. And I'm gonna do the upper one as a green. Because that makes more sense with incrementing things, doesn't it? And then I'm going to select both of the buttons. So hold down control. And I'm going to change the color of the text to white. Okay, that looks pretty nice. Now I'm actually going to bring this up a bit so it looks a bit better. Of course, we have to change the button identifier so we need to scroll up. It's called button too. We should probably call this something sensible, like subtract button. And it's the same with the add button, but we're not gonna do that right now. It's just a little tip for you as you're going and creating things. So we're going to change the text to subtract one. And now we have the UI all set up. Now we go over to our code file, the main activity, and inside the onCreate. Now I didn't mention this before, but I will now the onCreate method is what we call a lifecycle hook. So as the app is loading stuff in, you have these methods that fire off and say, hey, I've done this bit, then I've done the next bit, then I've done the next bit. And onCreate says, I have created everything inside of the view, but I haven't yet shown it to the user. You know, at that point that it's safe to try and access things like buttons because, you know, there'll be that you've explicitly been told that they have been created. Okay, so now we're going to find our subtract button. We are going to set its on-click listener. And we are going to have minus equals one for the count. And we're going to change the text view. Dot text is equal to the count D2 string. Whoops, two string. There we go. So if we save that and we run it in our emulator, guess what? We will have a fully working application. And I hope that you guys got to this point in the solution too. So add one, subtract one. What happens if I go past that? We can't get negatives with integers. Okay, So they are signed integers. There we go. So that's the class project. If he got to this point, well done, you've created your very first Android app.