Android App Development with Kotlin for Absolute Beginners | Muhammad Ali Yasin | Skillshare

Android App Development with Kotlin for Absolute Beginners

Muhammad Ali Yasin

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
21 Lessons (2h 14m)
    • 1. Download and Install Android Studio

      1:02
    • 2. Configure Android Studio for Development

      5:40
    • 3. Learning About TextView

      4:13
    • 4. Understading Layout,Activity,Views,View Groups

      6:21
    • 5. Project # 1 - Birthday card

      8:55
    • 6. Understanding Strings,Variables,Comments

      9:49
    • 7. Understanding Variables,Constants,DataTypes in Details

      8:30
    • 8. Changing TextView's Text and Displaying Toast

      9:17
    • 9. Say Bye Bye to FindViewById

      3:24
    • 10. Creating Counter App

      6:14
    • 11. Team Scores Counter: Part 1

      7:52
    • 12. Team Scores Counter: Part 2

      9:46
    • 13. Introduction to editText

      4:27
    • 14. Project 4: Displaying User Inputs

      4:28
    • 15. Understanding Functions

      8:03
    • 16. Creating app for finding Area of triangle

      5:10
    • 17. Final Project # 1 | Creating simple Number of coffee's counter

      8:09
    • 18. Final Project # 2 | Stopping counter from going below 0

      2:34
    • 19. Final Project # 3 | Adding customer Name and putting restrictions

      7:16
    • 20. Final Project # 4| Creating Layout for Topping

      5:42
    • 21. Final Project # 5 | Finishing up the project by adding pricing section

      6:56

About This Class

Learn the basics of Android App Development with kotlin programming, and take the first step on your journey to becoming an Android developer!

This course is designed for students who are new to programming and want to learn how to build Android apps. You don’t need any programming experience to take this course. If you’ve been using a smartphone to surf the web and chat with friends, then you’re the perfect target student!

Learning anything new can be tough. I'll walk you through the process of making Android apps, but to get the most out of this course, you must bring your enthusiasm for learning, and budget time on your calendar.

By the end of the course, you’ll build a simple (but powerful) app that you can share with your friends.

Transcripts

1. Download and Install Android Studio: us have got Osama weaken. Welcome to Android Development Bread called entry and them but one industry. I'll show you how to get Android studio. So open up your chrome or whatever browser you have, then go to Google and inside here you type Androids studios or android studio on. Then you click on this link on. Then you have entrusted. By the way, Andrew Studio is this Sophia using which we are going to create our 100 APs. So that's five year downloading it. And it's around two gigs on. Just read through this if you want. If you don't want, just click on this check button and click on Android Studio After a click on it, you will seem behind that it gets you'd redirected toe this page, install android studio now in here. Basically, they show you the instruction for installation that is clicking and going through the ah process off since relation like next, next, next and so on, so forth on as I have it already installed. So I'm gonna pose this on also in the next trail. Bye bye 2. Configure Android Studio for Development: humans of guy's American. Welcome to second chair off injury development. With Goldman on industry, we're gonna actually set up our android studio. So let us open up our enter a studio. No, We're going to create a new project and name it and everyone on. Then click on next. Now, in here, we have the android virgins, for example. We have KitKat, we have lollipops. We have marshmallow, We have no good. And now we have Oreo. Okay, so the best practices that you choose Ah, the one or a P I that supports maximum devices. So for now, I'm gonna be choosing maybe, like like like like like like 18 18 or not too old, but make it simple. Like 96 person off the devices on the Google store will be spurted if you choose the android four point or jelly bean. I'm gonna choose that and leave the rest because we're not developing a veer app or a TV app or Android auto app. So we're gonna go next, and in here you can choose a default theme for your app. But for now, we're gonna go with empty and then click on next on, then finish up now after it is done loading. What we need to do is really to goto file and then go settings on from here. We need to go to plug its and from here we need to goto browse repositories on in here in a search for Coleman on. Let's come down. There should be Courtland inherit the Courtland language on you need to just install it. I have already installed it. That's why ah, you will be able to see it in the tools and here coca So it is installed after installing it. Just come in here and click on configure Courtland in this project on Android with griddle on all module and click on OK, we don't sink. Now Portman has been successfully installed with your APP. So what we can do is this job can be converted to Coleman by clicking here and saying, convert gela file to Coleman. Or you can use the shorter key or double shift. And in here you can say a word, some out file. As you can see, it brings your job file to Colin and just present, enter or click on it on. As you can see, it has converted the court to Coleman. Now, uh, now ju need to display your app, which is currently in here. This is the happy you have currently that is called hello world and its name is Android One . Now to despair this APP units something called and similar. So to get an impaler click on this, I can in here every day, manager and click on the create virtual device. And from here, choose wherever device you want. Whatever size you want, I'll be working with 5.2 Next five executions just 5.5. It's up to you. After choosing it, you need to go to next on in here, you have to install the images you want. For example, you may want FBI level 26 25. Basically, these are for the newest devices being supported or not. So ah, one I'll be using is maybe Ah, no, but I'll be using No, but it's FBI is 25 and I have already downloaded. So if you want to use any other, it's up to you on. If you don't have it, you have to click on download and it's gonna start downloading on and then It's gonna, uh, allow you to configure it in here after I have done laureate, What you need to do is just go on the image and then kick on next and choose the name, for example. I'll say my first my first emulator, maybe. Um, you earlier, uh, in here I can I will use the portrait and I'll leave everything as it is, and I'll finish. After that, I'll click on this start butter. And now, as you can see, we have our Miller working and good. So you will be able to see that it will have a mobile interface. It will be complete mobile inside your computer on As you can see it, this is our mobile. And it is working with no, but 1.1. No, I'm gonna click on this, and as you can see, it shows me the devices that are connected. I'm gonna choose this on. I'll see in here that this, uh, ab will run on this device. And as you can see, it is working perfectly. OK, guys, that was all for this trail and I'll see in the next trail. Bye bye 3. Learning About TextView: us of guys. I am I like and welcome to turn number three industry. We're gonna be learning a couple of things. Such as, What is? Lay out. What is an activity? What? Our views. What is a vehicle? So let's get started. First thing first. What is a layout? Well, if you go to your app or if you're in your projects folder, open your APP folder, then go to your app on day, then go to the source on then goto mean and then go to resource is fold up. What I do is I always keep myself in the entry park so that I am directly in here on I go to do so. See folder. And there is a folder car layout. Okay, what is a layout layout? Is this the look off your app? Okay, then comes on activity because it says in here activity. Yeah, I can see that there is layout fold in here. But what I see in here is activity. And you're right. This layout is also known as activity, but not alone. The word activity refers to the logic that is in here The program that you create, the programming that you do. So the logic. Andi, look off. Your program is known as activity. So this whole thing when you played in your android mobile phone or on your emulator and it does something when you click on something, it does something. That thing is an activity. But this alone, the face off the app is known as the layout. Okay, then comes the views. What? Our views, anything you see in here is a view. For example, this text is a view on. We call it a text for you. As you can see, this thing is a texture. Then we have something else called button. So this is also a view called Button. Okay on then we have the check boxes. So this checkbooks is a view. So any control or any picture or any text owned, this white area is known as a view. Okay, simple enough. Then we have a view group are to understand vehicle. Let us go to the official documentation on if I except for view group in Google, I get to endure it. Ah, developers page on in here. Let us come down and we see that ah view group is a special view that can contain at the views. That is the main thing that we need to understand. So these view groups are in here in the layout section. The one they're using is called a constraint layout. Means this is a view group, something that contains use. Right, So it is a container that can contain under use. Now, here is a deal. If you don't have any of these layouts in here or continues in here, you won't be ableto put these views on your screen. So you have to have some players. The most famous one and one we're gonna be using are the lineal out and the relatively out . Then in Lena, we have the linear or is gentle and really near vertical on. Then relatively out. Let me show you how to change the layout for now, if you come in here, the first thing you see Android supports going through and so on, so forth. Just slip this on, right, Lena? Yeah, on If you come down in here, you will be able to see that this also changed too leniently out on, uh, in here, you'll see that everything is presently alive. means talk to port on the line. But if you want to change it, toe Ah, not fortunately, work quickly. You can come in here for orientation and change it to vertical. And as you can see, everything is ah, aligned vertically. Okay, guys, Dad was or for this drill. And also in the next real bye bye. 4. Understading Layout,Activity,Views,View Groups: use of guys them. I like them. Welcome to destroy industry of you're gonna be learning about the text through. So let's get started first. In first, I'm gonna drop text ruin here or in here. No problem. I'm gonna drop into here so that you can get used to it on then, as you can see, if we have a text. You in here? I'm gonna get rid of this on. We have properties in here on you can use the properties. For example. This property text basically means what text you want it to contain. Let's suppose I, um looking awesome. Go as you can see this change. So I am looking also, but I can not see anything. Right? Because Texas so small. So one thing I can do is again zoom in turns like this. Hand on. As you can see, I can Well, pretty much like Okay, I can deal with it, but it's not a good idea. Come on. Zooming in. So how? What between the size of the text, How can we change that? Well, I can tell you, but what about we go back in here on the search for text for you so that you get used to this. Ah, documentation on Understand how the documentations work. Okay, Now, in this text for you, we want to change sides of the checks. Right? So I can say size, right? And if you say size, you get a couple of things in here. But just keep going or you can come in here and OK, text size. You see something called text size size off the text. So we're gonna click on this. Okay, Size of the text. Uh, recommended dimensions are sp. Okay. For example, 14.5 sp. Okay, that's all. How this is how the size will book. So we're gonna come back in here, and this time we're gonna look at the coding section this in here. If it's like text, it's gonna go to talk according section. And if you like the design, it's going to go to this section in here. So we go to the desire text section on, we click on produce so that we can see what is going on our program on in here. What I'm gonna do is I'm gonna add something called text size on, As you can see, it said 14.5 s p. Okay, No big deal. Let's make it 20. Okay, it's growing. Right. Let's make it. Ah, 1 50 Okay, It's too much. 50. Yeah. 50 Looks good. So 50 s p By the way, this ah stands for what? The s stands were skilled and P stands for picture. Skilled picture. Okay, So using text, you use SP north DP or wherever. Now what I'm gonna do is I want to change this thing's color so I can go back in here and control off and then color on. I can keep searching for color, get curricula and so on, so forth. But I'll tell you where it is. Uh, ridden and searching too much. So if you go back in here, in here on a text color, this is the one text color. So we can change the color using this so I can come back in here on, say, text color on this is the one. And I can change the color. For example, I want to change it toe, maybe call a primary or, uh, accent, as you can see. Or you can add your own articular hash after 03985 wherever I am not sure what I'm typing, but I type this. Okay, You can go from F to a on. As you can see, it changes its color. This is the article A And if you want to know other colors, you can just google them RGB colors and you'll get thousands or colors are Okay, good, Nice. Now I want to Ah, maybe maybe maybe center it. How could center it. I can say gravity. And here I can say, uh, center. So insurgency now it is centered. Nice. Uh, what if I want it to change its background? Well, it is possible again. Let's come down on. Let's change the background to, uh, cools your 236 And as you can see, we have a nice looking background on. By the way, these are all rend, um, numbers. I don't know what these all mean, but if you want to choose a particular one, you can double click in here on change the color toe, the specimen color you like whether you know, the RGB or not, whether it will also appear in here if you like it, so you choose it on as you can see the killer off the exchange on. If I click on this on, choose this as you can see, the color of the background change. Okay. Nice. Anything else? Mm. Nothing's too much. We have something called old caps. Basically, what is going to do is if it's a true is gonna convert everything to capital letters. There's nothing too much to learn about this. And if you want something particular and want to learn about it, you can just look at it. Here you have the typeface. You have different family. You have other things to you can change. No problem. For example, lasting. Let's make this last time. I can say front family on Ah, from here it's ah, mortal space. And as you can see, the friend family is no more space. Okay, guys, that was old for industrial. And also in the next year. Bye bye. 5. Project # 1 - Birthday card: You must have guys. Osama American. Welcome to the destroyer in this church And be learning. How can we create something similar to this? So let us get started. First of all, we need to change the title from the birthday card toe birthday up early. So I'm gonna go to Project on In here. In the rest folder. We have values folder and inside it. We have something called Strings on inside in here. I'm gonna change the value from this toe birthday hard for you. Maybe that was it, right, So But they up for a liberty car for really no problem. I just changed the name. You can change it to whatever you want. Okay. Next thing we want, this thing in here, actually, this is a picture. So we want a picture in here. What we're gonna do is we're gonna come in here and say background. We need a picture in the background, so I already have a picture. But what I'm gonna do is actually delete for you on delete it. Okay. Deleted. I'm gonna show you how toe bring picture in here. So you go to the picture. Is pacific richer on you? just right. Click and copy the picture on Coming here. Right Click again and paste the picture on instead of this. Just a card on your okay. And now you have a picture in the drug ble folder on all the pictures Always go in the draw . Robles older. So always remember that. Okay. And now we need the picture in here in the background. So we're gonna say background equals, uh, drug deal card at trouble card on. As you can see, we have this background. By the way, this ad sign means the rest folder. So rest folder inside the restful that there is trouble and signed the trouble. We have card. So works like that. Okay, we're good. Now we have this Texan here. Hello. Word we can, man pleaded. But before that, if you come back in here, we see that we have this particular background color. Okay, so we have a color in. This will change it later, but let us first work with the text. What we need is we need the text view to me. Let's get rid of this, by the way, a new one so that we can understand how it's on text. Reworks a text. You okay? I text you lay out. Red basically means the weight of the text. We want the match parent. So the which is from start to the end. Fourth of it. Okay, for the height. Ah, As you can see, it specifies how much your wrist is. But if you get rid of this constantly out too leniently out on now, if I use a match, parent, Now you see that it states match Parent, Now in here, I'm gonna say rap content. It says repentant the match parent basically means that the rich will cover the full writ Means full screen off the red means from the left to the right. It will cover that part. But the height will not cover from top to bottom. It will only cover the part it needs. Okay, so it down it had nothing, so it doesn't need any space. So it will only take this minor space in here. Obviously, I'm gonna get rid of these two values because they don't mean anything in the leniently out Now. Now we need to say, Come back in here dearly. So happy birthday, dear Early. So I'm gonna say Really the text to be dear. Really? Now we need the color. So we're gonna set background color, No text. The text color should be ah f f f d 123 And as you can see, we have some color. We're gonna double click on this on from here. I'm gonna click on this drop whatever on, I'm coming here. And it's like this color and make my dearly to this color. Obviously exclamation mark in here. Now we do to change the size, so we're gonna say text size and we're gonna select, like, 50 sp. Okay, now, we needed to be more fat. Bold. So what we're gonna do is we're gonna say, Ah, text style in here Feels like bold. So as you can see now, this is bold. Now what we need is we needed to come down, right? So let, But pregnancy is lit. Civility, etc. Marzen nao Margin. It's a top I'm gonna Margin basically means the distance from the start point. Tow this thing in here actually, like if I put 200 dp as you can see, the difference of the distance from here till this point is 200 db. So it put a margin a distance to this. Okay. Okay. Good. I only needed 200 TB. Now I need I need to change the front family. So the front family Andrea, choose Serif Mona scope one of space for sorry on. And now we need to towards the rights on this a r right now and you'll say drove. All right, right. Padding, write or text. Select handler. Lotta right? We don't have anything like that. So you're gonna say gravity so that lets see gravity is bottoms and on and yeah, boots. And by the way, this should be, like 1 50 maybe. No, uh, 70 back in 70 works. Now, now, now, as you can come in here and see distant is kind till right? So what we're gonna do is ring in a tended we're gonna say the brook Tate. Yeah, rotate and we're gonna say 30 minutes. So as you can see it, retrace 30. If I put minus protest minus 30 now, we're pretty much done. Nothing special in here except this part. The color in here and the color in here. What I'm gonna do is I'm gonna double click on this on Slept this Drop our truth. This they said the top. Yes, This one. I'm gonna clip it Control. See on inside the folder the AARP, the resources folder. The values there is something called colors are the primary color. I'm gonna change toe this color Onda six Kendrick color also having the changes to this color. And you will see that this is what we have here. This is what we have here. Pretty much the same. The only difference now is this navigation bar. Whatever you many about or whatever you wanna call it is green. And here it is black. So what are you gonna do? Is via gonna go to stall on this item Name, um, navigation, Brockton style navigation bar color on and close this and I'm gonna sit at Carla primary on . I'm gonna come back. Let's do this on. As you can see, it is green. Now, if you come back in here, you will see something really strange. This is working, but it says there is an error. The error is that the navigation bar color statements require that your mobile at least should be supporting a P. I level 21. Now we're using a P I level 70. So any mobile phone which has FBI level 17 it will not work on those. It will work on those mobile phones which, as trendy one and above on the done. So we're done. Nothing special, right? That's all. Okay. Eyes that muscle for this trill. Hope you enjoy it on. I'll see you in an extra bye bye. 6. Understanding Strings,Variables,Comments: yourself, guys. I'm really coming, destroyer. We're gonna be actually learning a little bit cording in the logical section because we have already shown you how toe work with the XML, the lay our section. Now we're gonna be lending a bit about theological section to learn about a logical section . We have to learn couple off things in common and to learn about those things in common. I'm gonna be using a simple software. This is called Eclipse Javan Yoon. On this softer, I'm gonna be showing you in this software how things work in Colton. Basically, I'm gonna introduce you. Took open. I have this thing, I'm gonna take it out. Let us suppose I have nothing in here now. The first thing that Colin requires when it enders or ah when it rains or an app that requires when it runs is some programs some main program in here we will have to create a main program. So this if I press control and space, this comes the intelligence list. And from here, I'm gonna choose the main. And as you can see, I have made function means I have Ah, blob. Of course, that is Cartman. that is all. Let's forget about this. This is not our concern for now. Now, the first thing we want to learn in here is the hell over. Karam. The way to write Hello World Program. We're gonna say print on in here and we're going to see it. Uh, double quotation marks. Hello, world. No, Let his first analyzed this program. Okay, so the first part is the print. The print basically says that Display the results in the console. So print will display the result in the concert. But it asks what to display Were saying display Hello, world. What could display hello word. But what does this supposed to mean? These quotation marks. These are quotation double quotation marks. Quotation. Sorry for the caution I wrote. But its core Peixian marks uh oh. Are double courts double courts. So these aren't double course and men ever. You write something in the double court, it will be considered as a text or in programming terms. Visa. It is a string. Okay, so a print affection will print this print means display something in here. What to despair? Display hell over now. If I come in here, let me just close this on. If I come and rent this, you will see in hearing that it just space spillover. Okay, good enough. So in here, we learn how to write Halliburton program. But always remember that this is for Council on. We are. They're not working with the council. So the thing that we learned in here No, the print we learned in here the concept off string. Okay, now what if I want I have free made program, but I want toe include something else in the program. It's simple. You, right. Lesson here. And then you write, um, space and another world. Another world? No. What happens in here? These to get concatenation concatenation means these to merge together. No. If I were in this, which is hello, world, then they space that I included in here. Then end of the world. Okay, fair enough. Now we want to learn about variables. What variables? It's simple. Be right. Warren X equals 25. Andrea gonna print next. Now let us analyze this program before we press the play button in there. So the first thing war war basically means I'm creating a variable. Okay? You're treating a variable. And that is called X. Okay on. Why is it called Exit Can be called anything, right? Yes, it can be called anything. It can be called hello. And still it can hold 25. No problem. This is just a name on. There are a couple of rules for the name, for example. It cannot contain space. For example, I cannot say a B is equal to 25. No, I have to say a bicycle to 25 so that there is no space work it. Secondly, it cannot. We start with the number. I cannot say one one brother is equal to, let's say string value. That is, that is my name. So one brother is not allowed in here. No, no, no, no. On. Similarly, you can no start with the dollar sign or ah ah person. They sign on a couple of other side. Except the underscore. You can say underscore. X underscore. Ali is equal to for example, um 25. Okay, so this is allowed. But anything other than that is not allowed. Yes, you can include numbers in between. You can say age 25 is equal to true. Okay, so this left inside. Okay, let me clear this up. This left inside is the variable him and this right hand side is big data. And this data has couple of times, as I assure you, there is string and there is number like this. It is written and there is bullion. Julian bullion means either true or fools on at that time. It can include basically all types of data if I want to tell you that. But these are the three means that we need to learn about. Okay, So you're saying I'm creating a variable? Basically, anchoring is peace in the memory that is called X. So this is called X and it told value trained for and it holds value 25. No. Whenever I say x, it basically will call 25 in here. Okay. So let's Look, I'm gonna delete this. I'm gonna hide the ink now displaced for anybody. What if I want to say the number is 25? I can say this. The number is. Then close this on, then. Right place. And then we are in the number is 25. Awesome. Right. Well, it is awesome, but less possible. I have this thing in here. I have some text of after the, uh, ex. What kind of? Well, I can still go in here and right. It's just a number. And let us suppose then. I want again act at X. Come on. This is getting stupid. I have a lot off pluses in here. What I can do other than that is let me first. Horrendous. Whether it works or not, it works as a courtesy. But what I can do other than that is I can use a trick in here. I can say dollar sign s ask no acts. So dollar sign acts will basically mean that I am including a variable in here. This is a number. And it here it will display this value in here. Okay. And this is a number. This number is 25 on. I love the number Straight. Five on it. The thanks. That is this. Sorry. This this looks also now, if horrendous, you see these whole line and as you can see, this is simply too right. Slim, simpler to read. And there are no lords off. Plus is in here. Okay, The last thing I want to discuss video in this tutorial is the comments. Basically these air notes for me. Like if I write in here double double slashes and write this very well name, I should be changed, Lear, because X doesn't make sense. Right? So we have to write some descriptive. Very, really. Therefore, these air basically notes for me, Double slash And anything above after that will basically mean this is Ah, not so The compiler will not compile this. It will not try to understand this. Understand this And it will just ignore this text in here Districts in here. But if you have a long text, this this color seeing single line common. But there is something called a motel line. Comment that is slash ass tricks. Astros slash. Anybody anything? Sorry. Anything between, this will be considered as a common, and you don't have toe right? Double slash before every line. Okay, guys, that was sold for industrial and also in the next trail by my 7. Understanding Variables,Constants,DataTypes in Details: you must have guys. Osama American. Welcome to today's tutorial industry. We are gonna be actually learning more about variables. In the previous tutorial, we have learned that the variable var, for example X equals 25. And this can be a number. And this can be a string or Boolean or basically anything, any thing on in anything recall in programming and object, it can be an object, basically means anything. Okay, No, we're gonna actually discuss more about this. For example, let us suppose, uh, I have a variable which says, Ah, I have input box. Okay. On here, I can write the first name first name, and I create a very well called first name. Where is name, and I give it the value off this. For example, this is called edit next dot text. Reuse that text inside. This should go into this very well. Okay, So basically, I want this value to be saved in my very well. Suppose I were 25 in here on this requires Ah, name a stream, but I'm giving it what? I'm giving it a number. So this is really bad practice. If you need to first tell it that. I need the time, Toby a string. So the way we do that in Coleman is by saying we are. I'm creating a verbal called first name. First name on it is off type. This is colon, So colon type is string and, uh, text. I didn't text and the text nor text. So whatever value is in the edit text, I want it to be in here, and I want the value. Toby, text a stream. So this is the way you worked with variables on you can ah, actually tell it explicitly what type of data you want to receive. So let's take an example. Let s go back in here and let's suppose that I want the My very well, that's a first name. Toby. Off a time stream on it equals Holly was print back, so they just print first. I have a click on this thing in here. You will see first name inside in here. Okay. Working fine. If I write 25 in here, how's it gonna see? It gives me an error in here if I try this. No, Prince Ali. And there is no only basically this new program didn't run. So as you can see, we have it underlined with dread. So this is not allowed. So we can explicitly tell it that we need a number for a number of wheels. The keyword int. We need an end. Okay, so now it will accept the name doesn't mean anything, right? So this is a name first name. It can be anything. So this very well can hold integer value means a new medical value on we have important numerical value. So it will print that in America value. Okay, after that, if we come back in this article, we see something called Val in Khowst. Anvil is used to declare a constant and work keeper is usedto declare a variable. Let's try to understand this again. So we have a constant what is a constant course? It is something known. Changing things are so because there's something that there's no change. Does not change such as to is a constant it doesn't change through is a constant. It doesn't change. Our pie is a constant regard. It is always 22/7, so it doesn't change. This is a constant constant is something that does it change or something that you don't want it to change. For example, your birthday. First it for riel. Why would your birthday chant? Well, if you want to do something illegal or like if you want to be, I can't say it. But if you want to just do it, then you can do it. But birthday competition in reality, it will remain always the same. So these type of things that you don't want to change in your program, you declare them as well and those things that you want them to change, your declared them as far. So please come back and let us look at the article. So we have learned what is the difference between well, and what is the difference between war? Now let's come back down in here type inference or detection. The type inference or deduction basically means that if I save well, um, pie equals 22. Do you have a seven now? What happens is this village automatically understood by the compiler by the court mean that it will it is an end or it is over time, double or we have the types in here. It is off type, different type in here, for example. It can be long, short wherever double or float, Whatever you want to said. So our double is a value with, uh, with a with A with a with a decimal point where so Florida, and double our values rid decimal point. This seems coined, such as 2.35. So we can use, uh, double in here, uh, or floating here and float is a usedto is use for small numbers on double is used for 64 bit numbers. Means higher number A number with the power off 60 forward well this week and discuss that later. But this is how it works. The long except ah, very long number off, um, critters, like, digit long number of digits. And buy it except short number of digits. So after that, we have the bullion type. As we discussed. The brilliant type 1,000,000,000 is either true or falls. After that, we have the strings. As we discussed in the previous video. These are the strings. Okay, then we have the arrays. A ridge is none of our concern. For now. Then, as we saw in the previous cereal, we have the comment. Nothing too much about this trail. The only thing you need to understand in this tutorial is very bills can be declared like this explicitly. If you want your value to be explicitly or age if you want to read it to take explicit type off later, explicit time explicit type off there. Okay, so this is a really important thing for you to understand. First of all, the difference between while and bar and number two this part in hair, colon, string or colon, Long or colon end or colon bull Boolean. It's up to you. You can take all these. Sorry. You have to consider all these. Are you Can you have to think about these vile programming Because thes are really important thing and you will see them frequently into used in other programs while going through or vile analyzing other people's program. Okay, guys, that was old and ill to in the next trip. Bye bye. 8. Changing TextView's Text and Displaying Toast: us have guys, Osama. I can welcome to today's story in the structure of we're gonna be learning. How can we change the text off our text? Feel using cording? And how can be display a toast? Certainly. Ask a start. And we learned these two in the trip. So first of all, I would create a new project. Name it, uh, project to 1st 1 was a birthday card. Right? So I'm gonna from here choose maybe 19 because it's 19.1 person. That is a huge amount of devices on empty activity seem no in here. I'm gonna come to tools and go Cohen and go to configure the project on Android with griddle. Click on OK for a couple of seconds again. I can Then click on sink now again for a couple of seconds. No, We're going to come in here and people shift. Confer. Fine. And then I'm gonna convert this. So you already know What I'm gonna do is I'm gonna go to XML on. How did this on we have the previewing this side? I hope so. I'm gonna take this out instead of this. I'm gonna write linear layout on obviously I'm gonna take this out to. So the first thing we need is a text through which I just delete it because I'm stupid on direct, mean needed to be a match. Parents. So it because till the end, on the height, we want their content. So obviously we need to text. And in here we're gonna say unchanged pressed. So this is a protected that is called unchanged Text on. Let's give it patting off 10 db. Let's give it text size. Oh, let's say 25 dp o s P story. What? Again? What? Again? What again? Nothing. Let's center it. So I'm gonna say gravity looks upset. Gravity on gravity is sent a horizontal over your gun on down in here. We need a button. So you're gonna include a button? Obviously it's gonna be rack hometown. No, actually, Richard, match parent on how it should be. Where? Content on a as a busy. It gives you problem that you cannot see anything in here even though it is a linearly out . What is the problem? The problem is that there is no orientation. So by default, orientation given to this will be horizontal means from top to bottom talkto talked about. So as I gave this a few full with so you cannot see the better. So the easy solution is you come in here and right, orientation on vertical. And as against you have the button in there. Now you need the text for the better. So you're gonna say tax on Click Me Click Me On what as what else? What else? What else? It's enough, right? No, Something in here is called by and society. And I'm gonna say txt Uh, one. And here I'm gonna see p t n looks. Heidi, Heidi began. Okay, what is an I d? I d. Is the name which uniquely identifies this. So the button with idea bt and one is this button on the text view with I d txt one is this test for you. Okay, now let's go to recording Escorted Corey in here. What I'm gonna do is I'm gonna first of all nuclear very well. Var txt one or txt is equal toe, um find view body. So basically, we know that all of these this is a view. This is a view. I'm trying to find a view Which of you. I don't know. I only have it side. So I'm trying to find the view by its i. D. So the idea I have is our Minister Sources folder. I'd be There's the idea in the resources folder. So we have the resources for that. Let's go to in here. Let's go to store sources folder in the resources folder. Show me all the ideas. So in their associate for the are these are the ideas that I have but I did that I want is t extreme. Now we have found the i d. But we don't know what is the view. We know this is just an i d TX human, but it doesn't define the view, right? So we have to tell you that it is a text view. Similarly, let's go to our Bt and on physical to find view by i d. Our daughter i d daughter Bt and one it's up. But no, no. We have these views that now they are connected together with now this view the view, this view in here, the text view and the button views. These two views are connected now with the court. Now we can use them. I can say when I click on the button. So Bette and dot own sorry set own click listener means when I click on the button, then what? Then you have to use the apprentices in here. Sorry. The QWERTY versus in here Reading and Prentice's, which were these. You can put them, but they don't make a difference when I click on the button. Basically, I'm saying in here when I click on the button on when the t extend or text equal to, uh, my Britain Oh, exchange, I forgot that I named it text unchained. So I'm gonna click on this. The problem with my A. D. B or Richard Rises or the deployment target is start. First time I load it, I don't see anything. So when I close it and load a second time, you see I have all the devices available, so I'm gonna choose next disappear 20. Yeah, And as you can see it, we have it in here. And when I click on this button, this text should change. Toe text changed. So it's me. Click texture, Geo. It's walking. Okay, you're done with this. So now let us learn How can we display our post? So when I click on this this mark click May Burton. So it should display a toast, which should say you clicked a button. Okay, so when I click on this so it should be inside this click immigrant. So after that, we're gonna see post kept a pee boy s t toast door, make text on trying to make a cost. OK, so the first thing is this, um, basically in here, the contracts and this context basically means there Do you want it to appear on this context means on this ah, view which we are currently in. Okay, now we want to say the text that I want to display is, uh, you have clicked. But now we have 1/3 argument. For example, the first was context and context Means ah, this on char sequence charge sequence means the characters or the sentence and the duration duration will be toast. Capital T o s t dot lent short or long? Weirdness like short on at the end. Pregnancy. Sure. Okay, it's big corn. Where does it mean? Let's come back. What? Nothing. We got a fricking court and the thing is happening. Well, you didn't click on the button. Click on the button and you see you have click a button on this is called a post. A post is a hope miss it, which is shown for a short or a big, long time, and then it disappears. It's just a message for user to read if you want him. If you want to tell him something, then you can just use toast to give him a message. A particular message, for example. Please don't forget to remember your password or anything like that. Okay, guys, that was old. And also in the next room. Bye bye. 9. Say Bye Bye to FindViewById: you're was a guy's American. Welcome to today s tree. In this tutorial, we're gonna be learning. How can we get rid off? Find Dubai idea. We all know that if I come back in here on a racket for you that find view bidi view by Heidi this is it connects this view with this, uh, court. So it is. It acts as, ah link between this so that they can understand what it is. And when this button is clicked, this should something toe this text should happen. So basically, it's all about this thing in here. But the bad thing about this is I have to always save our for example, txt one is equal to find view by I D on then as taxed. Come on. This is stupid. This is so effort lack off. For example, if I have, like, 10 controls in here, I have 10 freaking stupid lines that I need to make right. These stupid lines contend like every line contain, like 25 to 2022 25 verse. And that is for me, really stupid. And it's not 20 to 25. Let's suppose it's our intent. Ah, words but this is really, really stupid for me on actually, the same toward the developers had and they did something awesome. Let me show you What they did is they said that if you go it into your app Ah, um more what is griddle on its in the griddle? Threes up a module. If you could go in here and add this time in here, apply plug in than coachman, then android than extensions. If you will add this line in here, less was. I have added this line. So something in here should tell you to sing this once. You sink this, then Well, there is a problem. Sorry. All right. Of this line. So if I try again on, you'll see that it gets a sink after gets sink. I can just come in here axe a txt one. Definitely directly. No need to do anything as find view by I d known it just txt one door text equals less. Oppose working it won't it will. It will run if I play this. But if I want the button to do something, I can just directly say Petey and wonder Set own click listener on in here I add this on Die this thing in here on apps, apps, absorbs, absorbs Yepes. It froze for a sec. Now, if I play this, it will re working correctly or awesomely, or it's gonna be working in secret orders on If I click on this it says working. Okay, as that was all for this trail and I'll see you in the next true. 10. Creating Counter App: yourself, guys. A Semicon. Welcome to today's tutorial in this story. A we're gonna be learning. How can we create a camper which increments? And Deke laments the number in the counter. Ah, let us have a look. How can we created then we're gonna make it. OK, so you're gonna have to buttons. Okay, I can just change this pretence value toe increments in free meant. And the idea also to increments begin in human. Um, in here. I'm gonna change this. Coupet. There's, uh, pressed it in here on change this incremento bt and d agreement on in here, I'm gonna say d Cremin the agreement. This will have the value off zero. We're very, very well. Here is the value. So the hint. Oh, it is a text field, so it will need a text rather than hint. So we're gonna say, OK, let's give it a hint. No problem. The hint is zero, and it's basically is something that only appears. Okay, you can use tanks, Texan here. No problem. But it hint also works simple. Is that okay? If you're ready now, we're gonna go to Ah, android activity. So on. So far, we have gotten rid of the begin one so it won't work now What? We needed to be in a say bot n small bt and implement dot set on listener on in here. We need this and again pretty in disagreement. Start set on listener. And we need toe have these two buttons on click listeners. So whenever I click on the beauty and increment this part of court or this court in these curly braces, braces should run on. If I click on the D criminal button, the court between these two curly braces should rent okay in here. What I'm gonna do is I'm gonna say txt one, the text or door set text. It's it's up to you. Their sect X equals Ah, like this, Like this. And I'm gonna say I need a counter. Obviously, I need a number which is common in between these. So I wouldn't save our counter off tight end on it holds values here, and I'm gonna see what company in here. I'm going to just cope with this, paste it in here. Uh, we have company in here. So what will happen when I click on the button? This it will show me zero. And when I click on the button again, it was from his ear in here. No. What can we do to instrument this? Well, we can say when I click on this button, counter should be called to counter less counter. So the counter hopes counter plus one. So every time I increment, the counter should increment by one on every time. Every time I d equipment issued decree meant by one Easy. Right. So let's play this on. If I click on implement, it will increment by one. If I likened equipment, it will decline mint implement. But it isn't inclement after that. So what happens is it increments the counter by one and there's nothing it thinking Medicaments counter by one counter is here. So it was a zero place one, but it doesn't do anything after that. Now let me explain this. Let us suppose our counter X is equal to suit. This is our country. Read it in this big work, I want to say let X, uh plus one be equal to X. Basically, I'm saying let X is equal to devalue effects, which is zero place when that would result in one, and that is it. Zero now, the next time this I click on the button, What happens is the word is the value off axe. Obviously, the value of X is one. So it's going to say X is equal to means here, X Unless one X is what one certain state, one plus one, that is, too. Next time I click on it, it's going to say X is equal to two place one because new value off access to so here will be to to place 13 So every time I click on the button, it will increments it by one. Okay, simple as that. So, similarly, with the DI agreement, it's gonna say X is equal to zero X physical two X minus one that is equal to zero minus one. That is a called a miner minus one. Again, if I say minus one minus, one is gonna become minus two on minus two minus one is gonna become my history minus three minus one. It's been a is gonna become minus four. So what we learn? We learned that we need to put it back inside what it is coming from for so witness account Physical to counter plus one in here. And we're gonna say counter is equal to count up minus one Assignment. Operations are not allowed in here. So what can we do? Well, it's easy. We can say we're gonna say Counter is a call to counter plus one and we're gonna just right campaign here. Andi similarly, we're gonna come in here and say counter is equal to counter. Plus one on it will display the new counter value in here. So display this and let's see what happens. Ah, increment groups working decommitted well, be committee is not working because we put our V ah wrote Plus, in here we need to write miners. Obviously you understand how it's gonna work. So that was all for this trail and else here in the next trail. Bye bye. 11. Team Scores Counter: Part 1: you know, some guys Semicon, welcome to destroy Really? In this tutorial or in this project story away, we're gonna be creating this thing in here. Okay, this is a school counter. This is Ah, basketball score counter. So we have Team A and Team B, so Dream Team A, um, points three mean scores three and team B scores, ISS. So every time you, for example, this time it stores another tree. So the number increases by three on this team. If it scores and then three again, it also increases the number three. This is how it's gonna work. And we have a re separate in the end so that the score go back to zero and their first section will be, and we're gonna be creating the program for Team A. So less sorry. So what I'm gonna do is I'm gonna come in here and take this text for you. Uh, if you're seeing here, we have two things, right? We have two things. Number one, we have Team one teammate and the bottom, we have zero. So we have to text, um, views. So we are gonna add to Dexter's expert, um, my sprint mass parent on record content again, Another text for you. Or maybe we'll just right in here. The text and the text would be team and maybe out put style A bit of style in it so that it's a bit bold on uh, no, this stuff. But at this time, this styled means another thing. So textile will be a bit gold. So I'm gonna copy this on. Put it here on this will be zero. Okay, on, if we come back in here, we will see some differences. It will be some problem, as you can see in here, because our layout is not in a particularly out. People aren't. So the layer we want is the linearly out. So we're gonna come in here on foot, linear layout in here. So that first is team A. On the other problem is that we need orientations. Oil orientation. It's vertical. Now we have Team A and Team B. Well, there is a problem that we can not see. We have team A. We have to owe it is there, but we can no see. It's so small. So what I'm going to do is first of all this layer ripped will be match current. Obviously, that's where we can't it. So if it now go and see its mass sprint. Ah, the score is really a bit twitchy. So too much small. So I'm gonna take first of all, take this out on I'm gonna do this size, so text size. Well, let's 15 s p between SP Oh, are maybe 20 years. Yeah, that's enough. Team issued this also me the team A text outs will be Let's ah, 25 to the four sp. This looks better, obviously. Ah, this was a test by me, So I took time. And this is one of the first projects I did when I was learning equipment. So I have every project I did ever since then, like the first time I started Courtland. I have, although projects saved. So that's why I have this remaining. That's why I wanted you to learn something with this because I also learned this and it was really important things. Okay, so we have these two. I'm gonna minimize these two now what we want now what we want is we want three but tons in here so simple. We're gonna have three projects So button uh, we need right content No mass parent on a rare content. And we need a text size text. Our text on video history. What's written? Yes, Bliss three points Lesson three bullets. Let's in a special Let's make it bold So I'm gonna say taste so well. Oops, it's style, I'm asking, Not size It's both on. As you can see, it's built. Okay, so let's give a 90 Heidi, and we're gonna say DTN, let's three. And as closes on DCA come in hand based on Pistor Obviously I'm gonna make it coming here on this also in here, but shift and top so that it's you can. Well, what instead of blustery is gonna be plus two right answers in a place true and its place toe on the last button we will be working with is a free throw. So began free throw free Throw that it's one point. So instead of blustery ankle right free throw, look it, We're done, by the way, these checks trees also need to have idea not this one, because we're not gonna do anything with this one. But this one needs to change the value in here. Right. So we're going to give a party party. Heidi txt Team a score, actually. Yeah. Really Drink looting, mating every but done in here. So I'm witnessing here BGN. So because we're also gonna be creating for can be, so we'll make need to make sure that these are different from team Be okay, No beer. Then let's go to the main activity. Not in here. We need ah, very built called counter or scores equals zero. So I'm gonna say Bt in free throw a don't set on Klaus listener. So I don't think I'm gonna say when I click on this button, I'm on the txt teams a score, the text or door set text to be equal to the numbers. This score. So the score, the scores and in here I have to say increase the score, so I'm gonna say scores equals scores plus three. Okay, so let's copy this. Oh, plus a one. Sorry, because pizza free throw. So I'm gonna cope with this on. I think this should work, so I'm going to clear this on. I'm gonna run it on this. No lessee, but it shows us. Okay, lets Stratus blustery place to becomes five, then 38 in a free throw, then three, then two, then one. Okay, guys, that was all produced. Really and well, completely surreal. Industrial by. 12. Team Scores Counter: Part 2: You must have guys Osama taken. Welcome to this trail and industry. We're gonna be finishing up our project, so last gets run first thing first. I'm, like, create a legally out on Give it a match, parent on much parent on. I'm going to just take all of these and put them in here. Okay? Now, this linearly are obviously needs orientation, so we're gonna give it broke up. Uh, well, add something called Lee Out Week on that will be equal to one. Basically. How much space do you want to keep it inside the parent, So I want to give it complete space. I'm gonna copy this on. Pissed it here on. As you can see, it's Officer says I want complete space because, as you can see quote So basically I have added a newly nearly up. So it it became in here on Everything is him. So nothing is different from the priestly out except for the ideas. So we're gonna change ideas. No change. For the first time, first text you this sexual needs to change society from teammate took team. Could be the first problem has been fixed. Now the second problem is If I take this line out, you know what gonna happen. But why is that? Because this one is asking for a full space. And this was a This one is also also asking for the full space. And orientation is now horizontal means from top to bottom. So talked about. And we have added this and this and they are asking for equal space. Okay, here then. Now there is a problem. I need to add the re separate, but if I ran a reset button button, what's gonna happen? You know, let's a respondent and wreck content. Let's add a text in here and say reset. Look at this. This is not gonna work. So what we're gonna do is via gonna again does something amusing. We didn't actually create a new meaning in the out inside this linearly. Are we gonna say right content? It is, Max. Parent on height is rep content on inside this we're in a northeast to lay out is too lenient layouts, obviously. Well, we don't need or invasion because my developed orientation is Yeah, we know. Your intention is or isn't it? Okay, so this and now we want the better there is a problem in here Wrong orientation, because this thing doesn't have orientations, so we need to give it orientation. Orientation is vertical, and as you can see, this is not working perfectly. Now we need it at the bottom or in here inoperable. I'm gonna try it here if you want it at the bottom. That is a different theory. You have to change this to relatively out at the bottom. If you wanted that, you're gonna come in here on change this toe a line so important a line current bottom now aligned current bottom and you're gonna set it to true. And as you can see, it is important. You know, again, you're gonna go and say layout, uh, center, so center presente you can set it true. And as you can see, it's in here. But if you want it here, you can throw it here using just lean early out. It's up to all the things work. No problem. But this is how it wa So this is how it's gonna be. Now let's come in here and we're gonna just co p we're gonna create score in here, so we need this to be scores A so right click in here Onda rename, And we can name it to scores. So if you come in here, these old changed to score Basically, the three factor think means that there ever is discourse a green in it. So old name is a bit scores will change to scores it, that's all. So what I'm gonna do is I'm gonna say, boom, you need some space. So I'm gonna come in here. I'm gonna say it came to be on It's me so nothing special. I'm gonna create score of our scores is a girl too. Now I'm gonna copy all these three buttons. Obviously, we will need to court the recent button too. So I'm gonna come in here as a reset button. We didn't give it. I d. So I'm gonna come back in here and give it I d the Heidi movie beauty and reset. Okay, these are things that you already know. So no need to tell you. Okay, now, now know what? First of all, that s reset. I'm gonna say begin, uh, recent door set on Click Listener on. I'm gonna come in here and say that the scores a equals zero and discourse be Africa 20 Basically, when I click on this button, these two scores will become zero. But this discourse will become zero in the background. It won't change the what? You see this course? Text view? What we need is we need to copy this. All right? We need to cover this and say this course A for the team it should be, has become zero. I'm gonna put this again. It was already copied, so I'm gonna come in here and change it to scores. Be so it's gonna also change discourse. Be and show Zito over there. Now we need it for the team. Button will come in here. Start changing is Toby's. First of all the buttons we're gonna change the button from is Toby on this? Also from A to B And this also from a to B. Now we're gonna run this and see what happened. No less. Say three pointer. Three wonder, uh, you know what happened? This thing has apartment in here. The team be I have to say the team B scores. That's it. That's course. 13 B, team B, Team B. Everything is good. Which one. Is this No free throw? Its three. It's checking. One hopes you have to change this troop, Team B. I'm just gonna work because everything else is working except this guy. So I'm gonna take back again. No. Plus three place to free throw working. We're going to click on Reset. And this is resented. This is not recited again. There is a problem. Let's come back in here on this. Need to be be No. Come, come, come, Come click 00 OK, guys, that result for district and also in industry by we have successfully completed the project . Uh, about the, uh, about the designing, you can do it yourself. I showed you how can you change this thesis, Texan? Here I can change the color. How can you change if you want to change the background color, you can also change them. No problem. Uh, just come in here in the background in here. I want to assure you how you can change the background color, right background. Then you choose any collect you want from here. For example, color, primary drug. Our color primary. Just cut a primary on, then color text, color, toe, white soul. 1234 cents. And as against, he just looks awesome. And you can just copy this, uh, put it everywhere inside, in here. So? So everyone will have this three pointer. They sound so. This is not so boom. You can do it. I told you into it. There is a problem. You can fix it, but it's all the same. You can increase the oh margin in here so that it's a bit away from each other. Margin, Let's say Rdp, as you can see there now, a bit, uh, spaced out from each other. Okay, so that's how you can create it. You can modify. You can change its color. You can make it both more beautiful. It's all up to you. I showed you the technique, and you Now you need to apply that technique to create a project on Don't forget to send with the picture off the project you create because it's gonna be really, really amazing thing to see you guys buy. And I'll soon in the next room 13. Introduction to editText: it was a guy's Osama. I can welcome to destry industry. We're gonna be learning about the added text to Alaska started. Let's suppose I want to take input from the user. So what I can use for that is if you come to text in here, you will see these things in here. I can use this. These are all edit text. So this is the name for the name. You have this plain text. If you want a password, you can use this and it will take an input as a password. And if you have email, you can use this and it will take the input as an email. Similarly, you can take this on. It will take, uh, multiple lines when you click on them. So if I read this as you can see, we have input forces. So here we have a text name. So as you can see, I have to erase this text. I have to erase this text to write my name. So I'm gonna erase this test text to write many. Now, this is a possible field, right? So if you remember correctly, this is the second field is the password field. So if I type something in here, as you can see, it becomes a possible the turd. Wasim It right. So I can see now in here. We have multi line. So I can type something. I can go to the new line and time something. I can go to the new line and type something, and I can go to the new life. This is how input, uh, addict textbooks works. Let us come back now. We in here name for name. Let's take everything out her name. We have text name in there, so I have to erase it to Ah, write it right. So I have to raise this text name to write my name. What I can do is I can basically take it out. I can come in here and take this text out instead of this text I can write something called hint. Hint Will basically disappeared by itself against that name. It will disappear by itself when you start typing. So you will see that once the, uh started this program. So basically, this has an idea off e t edit text, so I don't need a button. I'm gonna save button on obviously restaurant at repentant, and I need it. I d I need I need to be Let's say pretty and click on. I made some Texan during currently to be empty during this test, and we're gonna call it Click Me. Now, let's go to the main activity and we're gonna come in here on, say, Weekly and Bt and click dot set on click. Listen up on in here. What we're gonna do is we're gonna say a tit text. I had a text in dot text got to a string. Basically, I'm saying in that detects that there is a text on. I want that text too. We converted to strength and this strength text. I want to display this string text inside a toast, so I will give it a very bottom bar. My at a text edit text on. I'm gonna put it inside of variable. Ah, and we're gonna go toast and Mr Toe start make text and inside here and we're gonna write this. And the second thing will be the charge sequence. That is my edit text. Charset wants me into the text on after that in here. I'm gonna say toast what's closed. Don't length short. And then I'm going to say sure now if I played this and be it for a couple of seconds. Now, if I start typing in here, this text will despair by itself. You remember last time we had something called naming here and he had to raise it to right this time? No, You can just type paper, name and click on like me and you. As you can see, you have a toast in here working perfectly. And this is what an added text looks like. Okay, guys. Dad, frazzled for this trail, and I'll see you in the next trip. But my 14. Project 4: Displaying User Inputs: humans have ghosts. American welcome toe the foot project. So let's get started in this project. Basically, I have three other text boxes and one text view. So in the agit text, we have basically Ah, I think what type as text Person named and hint is personally on the ideas et extra first name in the 2nd 1 We have idea. Takes a txt last name disperse first name and this is last name on then Same everything else is him. Except this last name. The hint is last name. Lastly, we have email, so e txt we have to say email story. So let's say E t s t e mail on a it has hit email and it's type is text email address. Then we have a button. Nothing special beauty and click on its Click me again. On lastly, we have a texture which is matching this taking over this area in here. So this area is it is sticking or so master apparent mass parent and its text size is 16 sp on. Basically it is called txt. So what we're gonna do is when it click on this whatever is written in here, it should go it down in here. It should be placed down in here, so let's get started. So I'm gonna come in here, and this is my previous project. So I'm gonna click this and get rid of it and start like beauty and clicks. Don't set on click Listener on in here. I'm gonna say our first name. Physical toe e txt. First name door to or text the to string. So you are last name. So I'm gonna say last name is equal to e txt. Last name dot text thought to string. So basically, we are getting the text from the user on converting it into a string and then putting it inside the very well. Similarly many very book for the emails. Email I z crawled through txt email on Gore Tex Thought to strength. Okay, now what I'm gonna do is I'm gonna say var output Are is it going to txt arquit dot text so t exceed the awkward or text Or basically, txt are put or you can even take this out. Doesn't mental output. The text is equal to first name inside the shrink, so I'm gonna I see first name so first name is equal to first name, then slash end its escape sequence Basically me and slash and mean basically, after this text is going to create a new line and up in this new line, it's gonna see, uh, lost name them, lost him again. Slash in email e mail or e mail on that is Oh, So what I wonder is, when I click on this, the text in the outward traits should change to this. It's gonna say first name, then whatever. I entered and lost last name. Whatever I entered and then email address. So let us renders and see how it before known as enter first name that is Ali on the last name is seeing on a The email is P ah s J for oh, at Gmail. Don't come Now I'm gonna click on this, as you can see. First name Holly. Last name Yasin. Email address. PSG for up you guys That was old for industrial. And I'll see you in the next trip. Bye bye. 15. Understanding Functions: You must have guys a samurai can. Welcome to this tutorial in this material. We're gonna be getting introduced to functions. So let's get started. Functions in Cortland basically mean block off court. Look off, cook, and you can see this man is a function, and it is a block off court. So whenever we're in Maine, we basically are running whatever is in this block off court. Okay, so what if I have another block off course that is called Say hello on venerable Renner program this block, of course. Children. What? But the problem is been every car or really run a program. The only bloke of court that is run is this main look of court or main function or also known as method method. Now we call it as function. But because Colin is a functional programming functional programming in other languages, sometimes it is referred to as method. But in simple words, we call it function. So now if I have a function called hello or say hello and I want to ah, run couple of statement inside it. I cannot run it because the only function that would run when I run this will be the main function. So what is the way to rent this function? The way to rent this function is basically in the main function. You say. Say hello on Francis's on your then. So basically, this is called calling a function. You're a calling a function inside the main function. Now, enough with the theory. Let s create a simple function which will say, say help and the naming of the functions is same as the naming off the variable. So we say help. And then Prentice's and then the curly braces. So in here, I'm going to say friend Ellen, and we'll say ho. So if I read this, it will not do anything because obviously there is nothing inside. So if I call this function in here, I'm gonna say, Say hello. Basically, I'm calling the function. Obviously, when you can often tell, you have to prove these Prentice's on Now. If you call it, it's gonna display how Right. But what if I have a name on it? I want to give it on there. So I didn't say here. Say hello, Ali. No problem. Hello, George. No problem. Hello, Sabrina. No problem. But what if I have a input from the user. So let s suppose I have input from the user and I want to give that input or put that input inside here. So the way to do this is in the main function in the function which I want tohave an input . I'll say the name of the variable in name on its type is string. Now I am having a variable which is of type string on. I'll say that I want this variable to come after the need after Hello. So hello. Name. So it could be Hello, George. Hello, Sabrina. Here. I'm gonna put the name. Let's say I'll cut a leak or better savory on and on. Uh, run this and it says Hello, Sabrina. So, what is this in programming language? We call this an argument. So it's an argument. Okay. So we can have many are as many arguments as they weren't Maybe after the name. I want it so I can put coma. And then I will put the name the name of the variable age Ah than Colon. And in here, I'm gonna put the type that isn't on in here. Then it coma I can put 25 17 days, 25 years old on in here. I can put slash and means new line on so on. So for it you can do more lots off stuff in here. So basically, this is how in putting or arguments work in function. And this is how function for But let us suppose I have a function which returns or something so returns something. I suppose I have a function that is God, uh, some two numbers, some of two numbers, mistakes to numbers as an argument. And sorry number one time in similarly number two off type. And now in here are going to say number one or I could just add it. I can say some is equal to the dollar sign inside here. I'm going to say number one cliffs. No, he's right on inside in here, and it needs to arguments which are numbers here. I'm giving it string. So if I tricked out strength and put number in here, let's say 25 uh 36 and I want it to return something in here, so I want it to return. So I will say retraining this basically what return means. Return means that you want it. Ah, to return somewhere. You you'll see what? How it works. But here, I'm going to say, uh, String. So basically, I'm saying the type off return that I want is strength. So if I want to return to be number, I can take this out and asked for an integer number. Now, as you can see, it will give me into your Obviously, it considers this string. So I have to take this so that it can consider this number. Now, this is an end that is strange. Five plus 36. Then after that, it's gonna summit, and it's gonna give it back in here. So if I run this there is a problem. What is the problem? It says there is no Say hello. So we'll need this. Okay, now let us run this no result. Well, it brought the some off this inherent, but we didn't print it, so that is printed print. Ellen and I want to print this. Um, move this the sum of two numbers. So this value in here will change into the some off these two. So it became 61 so what happened? Let us make it simple. First of all, the function was called or a method was called and it said I want to see some two numbers on I have to import. So these two input came in here, So it began training five and 36. Then they came inside and said, Oh, this is 25. And this is 36 means the result is where 61. Okay, what do is 61 then? I said return 61. So it's gonna return 61. So return means replace. Hold this court. Let's 61. So when I print well, obviously I get 61 because there is 61 remaining India. Okay, guys, that was over for this trill. And I'll soon in the next trail. What? By 16. Creating app for finding Area of triangle: you know some guys. Osama recon. Welcome to this tutorial in Destroyer. We're gonna be learning how to create a calculator which will calculate for us the area off triangle. So let's get started first. Awful. In here, I have a texture than an edit text. Fewer than added text area than a button then at and we have another view. So we have two views to edit. Excuse. And one button for the calculation, That's all. Now, let's go to the main activity and in here. First thing we're going to say is we're gonna save when I click on the button. So DTN calculate door set on click listener No, out in here. I'm gonna create a function I'm gonna say function area. Who triangle? Known as understand. Where is an area of triangle? Let us consider square. So in square, we know that scary is length, Times width. Right. So, Len time Bert is area square. But if I can really destroy half what will happen in this area? What is it? It's a triangle. It's a triangle. So this triangle basically, we divided this into half So any of triangle where the formula for area of triangle is length into it or Lenten to breath or lent in tow, hiding toe or hiding toe based whatever you consider, it's basically dis portion in here on this person in here. So when I multiply these two persons acts and why I get the area of triangle on after obviously dividing it by two. Now let's go back to courting and in here I'm going to say return Thanks Times Why Divided by two and what are X and my mystically there are inputs, So I'm gonna say ax is off time in on why is off again. So these are the values that I will be required from the user now in here, I'm gonna say you are X is equal to tst You this on No test. Not for a string. Not true in so basically the number that is in here in the attic textbooks should be converted. A string means as a sequence of collectors and that sequence should be converted to end indigenous Now in here, obviously grossing, I request to values X and y so here I'm going to say, uh, the value off txt result the text is equal to If triangle triangle. But why is it not share shrink? Because obviously I A music it inside this seem function or same method. I have to get out of this method and in here. So now if I say area off crying Allen in here, I give it to will use that X and Y Andi, I say that this is in here, so I'll take this and put it inside in here. I'm gonna say area equals the result in here. So, uh, where does it say it? Say the time doesn't match. So what, I'm gonna sort of say in here when I say they captured me. And so the returning time for me. And now let's try this and see if it works in here. I'm gonna put 25. So 25 height is also Ah, Proculus. Suppose five. And I'm gonna calculated its 62. So if I come in here and I say 25 times five driver too is around 62.5. The result I'm getting is getting in is in ah, indigent number. So obviously I can convert it into double by coming in here on just from here from to string toe into You're gonna say to double. Now, let's try this again. Again. The value is 25 and here it is. Five. So it should be now 62.5. Okay, guys, that was owned for destroyer. And I'll see in the next year by 17. Final Project # 1 | Creating simple Number of coffee's counter: Here are some guys. Assam are legal. Welcome to final Project to turn number one. In this tutorial, we're gonna be first of all, changing the name off this up two official. So let's get started. So in the android section, we're going to go for the rest folder and in the rest ful that we're gonna go to strings on in here. I'm gonna change this out. Name, toe, coffee shop. So coffee on. We're gonna come back. That is all. And as you can see, the name has changed Now in the leniently out. The first thing we need to do is we need to change the orientation to work. ICal work now the orientation has changed. Now, in here, what we need to do is we need a button. So you're gonna put that Britain in here? Obviously, we needed wrapped content and wrap content and we need the tech story plus Well oh, it's tech sites. I just need tax and it's every place. Obviously we need Texas, So text size. That should be 30 sp cause it's a text size. Now what I want is I d say i d be tiene in agreement on just close this and corporate taste it on. Now I'm gonna open it and all I need to do is say Bt and d cream it in here in the agreement Uh, this in here? It will become minus nettle Now, in between, I need text view, which will say again, rap content wrapped content Doesn't matter what we need. The text this text to contend is zero. Obviously, we have text size. That is 30 SP Andi, I need it a little bit in the middle so I can put a bit off padding like 10 dp on a bit of margin Marzen lift. That's a 20 dp. And as you can see, this is in the middle. Okay, Now we need ah, um text you again, text for you, which will display again match parent, This will be on match, Parent, this will be on in here. We'll have nothing, but the idea will be txt with it. Or maybe you give it some, uh, text size. Not just like Teoh service be okay now. This should be enough. We have I d India in there and we don't have idea for this. So you're going to say I do. Ctn number call Kofi's on, that is all. I'm gonna close this. Now Let's go to the mean section. And here I'm gonna drop the DTN Interim increments on Don't set on click listener B T n detriment Hopes there is some problem, but let us beauty and equipment thought Set Conklin Listener I have messed up with one off the ideas so well, this is beauty. And this is txt. Txt Number off. Yeah. Now vignette. As we created one encounter last time in one of the trills here, we'll also create a counter. The country will say number one who are, uh, counter is equal to zero. And here I'm going to say txt number off coffees. Um, the text is equal to double quotation marks than the dollar sign. Then weekly basis And in here and we're gonna say counter, but before counter, we're gonna send minus minus. What does this mean? Well, this basically means counter. Is it going to counter minus one? Remember, the last time we did this did this, but this time we'll use this. It's all the same, but this is shorter. Wedging off it on its called Implementing this is dick lamenting or we want to implement. So if you want to implement, will say we'll put classless and that is also here. It will literalist. So rather than putting this whole line, we can put just plus plus counter and minus minus country. I'm gonna put it here too. And here we're going to say minus minus company Now, after the button has been implemented, what I want to do is I want to create a method function on the matter. Name will be, are put and awkward. Busy txt our court. The test is equal to let me just close. Thies too on. Let me just give it some space so that we have enough space in here So we'll say txt awkward is equal. Toe this on. We're gonna say number fees. Dollar sign number. There are a number off crew fees. Where is this? We don't have it. Right? Well, this should be in here because this will be an input in here. I'm gonna say so. Here. I'm gonna stay off time and on this. Is that? No. The last thing we need is a button and not the but tense. I'm gonna copy this on here? I'm gonna say bt and order. So let a separate Ian for the on. Where is it? It's in the last. Why that I don't understand. Oh, because well, this text view is taking hold list. So all the only place we have is this one. So in here, I'm gonna say, obviously, 30 sp is too much. Someone is 25 on for now. I'm gonna make it. Ah, match. Okay. This should be enough. Right? And beauty and order. So let's come in here and say whenever I click on the bt in order Bt and Order set on flick listener, what I want is I want the output to be displayed and in here on the number off coffees to be able to counter, Huh? Basically, if the number of coffee is 10 so it's gonna dropped 10 inside this and is going to see a number of coffees 10 That's all. Now let's run this. Okay. Stratus Angara's plus place. No, I have order off three profits on a place, the order, and it's going to say number off coffees three. If I have seven orders and we're gonna click, and it's gonna say it. Number off Kofi's seven. Okay, guys, That us old for Destro Il. And I'll see you in the next trip. Bye bye. 18. Final Project # 2 | Stopping counter from going below 0: us of guys. Them antique unwelcome toe final project to our number two industry. We're gonna be fixing an issue with our app. That is, if I come to minors and it goes minus, that is wrong. Obviously, it shouldn't go to minus on a to fix that. What we're gonna do is we're gonna be using something called if stick what fixed it. If statement is basically and statement or ah program thing, which basically says, whatever is inside this are these Prentice's. If it's true, then this, uh, part run and that's what Otherwise it will not run. So let us suppose our counter is counter if counter equals double equal sign, basically resulting equals comparison. We're comparing if the counter equals zero. Unless that we have worked counter, that is equal to now 12. So if the counter value is equal to zero okay, then it should say drink, Ellen and the count here This is just a test. So now it is not going to display anything because the counter is not Syria. So what if I change it to zero? Well, it then displays the counter is zero. So it checks whether the condition is true. If the condition is true, it's gonna around these statements inside these credit versus. Otherwise it will not run this no compact or a project. Let's do something about this problem that we have seen now that as closest on that's coming in here, I'm gonna say if counter is created than zero, then this obstructions subtraction should happen or deep lamentation trigger. Basically, if the value is Europe, it should not subtract if the value is one issued subject. So let's try this and see if this actually works or not. Now let's go to close escort minus. It doesn't go below zero because now it knows that come on cannot go below zero. Okay, guys, that was over for this. True. And I'll see you in the next trip by 19. Final Project # 3 | Adding customer Name and putting restrictions: You're welcome, guys. Osama American. Welcome to the city area. In this tutorial, we gonna ask for the customer's name because we have We're done with the The number off coffee is now. We need the name of the customer. So what I'm gonna say is I'm gonna come back in here on I'm gonna It's a text for you. Yeah. Rap content. Recommend int office with the text size will be 25 sp and the text will be customer just customer or may because from her name on under it, we're gonna have an edit text, which will have ah, crap content and referent. And actually, this will be Max current. We need i d. So I'm gonna give it idee off e t. Extremely txt at a text. And I'm going to say customer. So customer name, obviously. Nothing much but me. Maybe we can change the size of against a text size the text size to be 24 sp here too. 25 story. Okay, let us close this. Let's close this and let's go into the main section now in here. The first thing I want to do is I want to add a very but very boat customer and the customer me because from her name, you can see is equal toe e txt customer named or text start to string. Now, what will happen is when I click on the button, the e txt value will go inside the customer name. That is all okay. And I want to have a customer name as an input as a perimeter eso I need to add that permitted in here. I have to say customer name both times. Strength? No, in here. I'm gonna sit customer now. Obviously, we don't have it in the text, So I'm gonna come in here less and in here, I'm gonna say, Look, no need for the name and I'm gonna say, uh, customer needs and obviously slash And for the new line on lessee. No, As you can see, I have to happen here. I'm gonna type my name. Yeah, ally Andi. I will place the number off coffees or the number off. Whatever on, I'll take an order. So when I click on order the customers early and the number off coffees at Rick, But let s suppose I don't enter anything, so I'll come back in here on. Take out everything from here on. Say order, obviously to say customer nothing or the number of coffee, so it shouldn't be accepted. The user has toe have some customer name or the receptionist or whatever is in the count on the counter. He should ask for the customer name. That's not a requirement, but because we're learning so which it is a good thing to learn about nine here. I'm going to say if the customer name is empty, then basically, if the value in here is nothing, then if there is no value than will display a toast which will say so what will happen? It is gonna check. Is it empty? Yes, it is something. So it's gonna show the toast. Then it will try toe are put the value Well, this is wrong. If it is, uh, empty, then it shouldn't our four devalue. But if it is not empty than it should our party value. So here we can say else so else what it does It says if this will you is true means if it is empty, then it will display on Lee this on if it is not empty minutes. This section is false. Then it will run the l section. So if it is true, the if section reverend, if it is false than the as section immigrant. So let's try this. Not in here. I'm gonna type my name again. So I'm going to see Ellie on the number off coffees. I'm gonna say three early, okay? If I don't have the name, and if I try to place the order it says please enter the customer name. Okay? Now we fix this problem, but what about if there is no order? Let s suppose I write the customer on. I said the order is zero. Well, it doesn't make sense. The number of coffee should be at least Ah one. So in here, I'm gonna say again, we'll have another condition. If if counter is equal to zero means there is no order. The zero order that will display the toast. So I'm gonna take this on a place it here. Well, there is There are shorter ways, but because we're learning. So I'm taking this. Really? Ah, extreme mayor. So but if you are ah, advanced program that you can do it easily with less effort, but we are gonna make effort in here so that we can understand how things work. So we're going to say please would, uh, at least one coffee. If it is it, if it is noted or else we're gonna say we're gonna put this else this play this now first is going to check the number off orders. So we if we have zero orders, means the counter is here, then it's gonna say please order at least one coffee. But if it is not, zero means it is 123 whatever. That is going to go to the L section because this is returns. False counter is equal to zero. No counter is not equal to zero because counter physical to 10 and it is not equal to zero . So it's it will go into the else section in the L section. It will check. Is the customer name empty? If it is empty, it should display the toast. Uh oh. I get the toast. So we're going to say please and took customers name on Duh customer. So now if I check this and if I click on this So now I suppose I entered the customer name , I say Ali on. I don't take any coffee and place. Order. The order will not be placed because it will say Please, please place at least one order. So let's suppose I place one order, but I don't put the name, so let's not pertinent now. If I try this, it's gonna say, please enter the customer name. So that was all for this trail and also in the next room. 20. Final Project # 4| Creating Layout for Topping: your use of guy's American welcome to destroy industry. We're gonna be learning. How can we at topping on here? So we're gonna be adding topping on this side. You're going to be adding section where it will say topping. And here it was number one, It will say Whipped cream number two. It will say our chocolate talk with I don't know this probably. But whenever so there's this much we're gonna be doing. So to do this first, we're gonna be creating linearly out, okay on, driven by creating another lenient layout on in it on another linearly out. So this section will be this section on this section will be this section, so we need to create three linearly out. So let's get started. The first linearly app, which will be the top. So we're gonna sell Vinoly out, obviously mass parents and wrap content in here. I will have another lean earlier, Richman said, right content and wrap content, and we're also gonna be creating and deleting out that will be linearly out again. This will be mashed parent on rap content and that is all. So in the first linearly are we're gonna drop the's three buttons, two buttons and one text view on will drop it in the first, uh, linearly out. Obviously, as you can see, it creates a problem. So let's say orientation. Who's a vertical? No, this is fixed on your gonna just close this because this section we have a complete grading . So this first section has been created. Now we need to focus on the second section for the second section. Much we need is we need the contents. We need our text. You We'll have a text room, which will say, rep hunted or match parent wrap Clinton on this text, you will have text thing talking. What you on? Let's give it some text size. So for text size, I'm gonna say it 25 sp on for the color. I'm gonna say hola. I'm going to say black. So have 000 and that is all. After that, we're gonna be creating something called option buttons. So in here, if you come down. Oh, radio. But sorry, not option pretence really wouldn't. So if you're gonna be creating these protests, so let's scream them. Who knows it? Radio? No ready. But then we'll have much burned on a wreck content. Similarly, we'll have another radio button, but to say match parent and content. And as you can see, we need the whipped cream and the chocolate. So this will have text off chocolate text color. It's a black on the text. That's Ah, chocolate fork lift. I think that spelling are wrong, but who cares now? This These Britain's actually need to be in a group and that is called Radio Group. We need to put them in really cruel. So it's gonna be math current at wreck content in this group. I'm gonna add these two buttons. Obviously there is a problem because something is taking the place. It needs orientation. So let us give it orientation. It's gonna say orientation is vertical. And as you're going to see, we're getting something in here. Okay, Okay. Okay. Then the first radio button, you're gonna say this really button will have text off. Let's see whipped cream on the witness it text size. Is it good to 24 SP? Similarly, I'm gonna cook with this. Put it inside in here, saying 24 sp. Okay, now we need a bit of distance from this topping. So what I'm gonna do is I'm gonna go to Radio Button. I'm gonna say Margin top. I'm gonna sit 15 dp member. Okay, so the distance between these two buttons or radio buttons will be margin top again. I'll say five dp, maybe. Or 10. That doesn't mean it doesn't make a difference. Oh, this need to be bottom. So water now it looks cool. Anything else? Well, nothing else that is old. So we have successfully created our now. Okay, guys, that result for this tutorial. And also in the next shirt, my 21. Final Project # 5 | Finishing up the project by adding pricing section: You're welcome, guys. A South American. Welcome to another editorial industry. We're going to be calculating the pricing when the vic cream is added or chocolate is added or nothing is added. So let's get started. First thing first. We need the price for the coffee. So what we're gonna do is we're gonna say you are coffee prices, coffee. That is, for now, equal to zero. Now, uh, now you're gonna come in here on in the else statement off the are put on in here. We're gonna say close. The prize is equal to that. I suppose one coffee is for $5. So you're going to say, uh, counter times fire. So if there is one, coffee is gonna set one times five is equal to what? That does it for five. If it's two coffees, so two times five, that is a $10 means is gonna work. Perfect. Now, now we need the price off the top in. How can we get it? So in here, I'm gonna create a function called hoping Course. Obviously, for that I need a counter. Uh, discounter. I'm gonna old enter in here and create a function that is called topping price. And as you can see in here, a function has been credited. That is called topping price. No, in here, I'm gonna say the return type is interview. Is it returned? So I'm going to say it's the radio button one. So radio button story whipped cream dot is checked his checked Mies. If I select the, uh, this cream, then what do I want to do else? If that's it. So it means that if the selected really Burton is the are green, then do something else. If the selected radio button R B uh, tea and chocolate is checked, then this should happen else. This room. So, as you can see here in here, I can have multiple conditions. If I have Ah, I can have this one condition or multiple condition. So in this first, if section, I'm going to say if the beauty and whipped cream is selected and I want to return to me count the times one countless times. One what? So if I have ah, or I like to suppose it's $2 so I'm gonna put two in here. It basically means if you have ah two coffees, so it's gonna multiply two by two. The result will be for okay, if you have 10. Coffees is well and multiply 10 by two. And the result will be $20. Simple. But if the whipped cream is not selected and the chocolate is selected, we can say return. You count the times one. This basically means if I have 10 coffees, it's gonna multiply by one. And the result will be again 10 if I have 20 coffees. So this is cheaper. The the chocolate topping is cheaper than they were cream topping. No. Lastly, I'm gonna say return zero, we turn zero. This basically means if I don't have any topping selected, so I am not taking any topping in here, So the topping price should be zero. Okay? No, I'm gonna come back in here, in here, in the else statement. I'm gonna say the talking. Oh, sorry. I'm going to say what clumping price is equal Toe topping. Press counter? No, in here, I need new imports. So first in court I need is coffee price and the other one is topping price on. I'm gonna come in here and add these two things, so let me Just close this in here. I'm going to see No, I need Ah, coffee price. Looks like on a poke in cars off time and again in here. I'm going to say the topping price for the coffee price prize dollar sign. Coffee price. The top in price is off time topping price or the value will be talking price. Then in lost in here, I'm going to say full price will be equal to looking price. Close the coffee price then. Lastly, I can say in America. Thank you. Now let's run this and see if it works. Good or not in here. I'm going to say the customers again, Ali, because it's the easiest name I can find. No number of coffees are too. We're gonna order. And as you can see, it is customer name is Elie Nebo. Coffees at two. Coffee prices. 10 minutes dollars. You can put dollars in here. Andi. No problem. For example, coffee price in here in a dollar. On in here. Also dollar and in here are so abdullah. Or maybe give it one spits and it's there. You can add it later then. After that, it says topping price I zero and total price is 10. So obviously total prices then. And thank you. Known that? I suppose I asked. With whipped cream? No order now topping prices $4 because whipped cream costs $2 for coffee on total price will be obviously $14 because 10 plus four is 14. Now, the chocolate. If I order as you can see, the topping prices $2 on it. It's added in here because one, uh, chocolate topping is coast. $1. Okay, eyes that muscle. Bye bye.