Wednesday, May 6, 2020

how to learn android studio SM Zee Soft.com

  Welcome to this on the Kotlin programming language. If you're not familiar, Kotlin is a statically typed programming language developed  It's been around since about 2011 and has steadily increased in popularity ever since. Today it's actually the primary development language for Android and in this tutorial, we're going to move from basic topics like setting up your first project up to more advanced things like modelling data and working with higher-order functions. 

The goal for this tutorial is to help you understand how the work with Kotlin so that you can then take that knowledge and apply it to building applications across mobile, web and native code. So without further ado, let's jump in and start building our first Kotlin project. The first thing we're going to want to do is to install JetBrains IDE Intelijay so that we can work with our Kotlin code on our development machine. 

The first thing to do is to open up your browser and search for it. Until Jay here, you should see a download link and we can click on that to be taken directly to the download page. Now I'll be working on a Mac, but intelligent is available on Windows and Linux as well. You'll also notice here that there are two different versions of intelligence. There's the ultimate edition and the community edition. The ultimate edition has a lot more features that we need and there's also a paid product. The community edition is supportive for JVM development and Android development, 

so it's perfect for what we want to look at this tutorial. When you're ready, go ahead and click the download button and that should start the download. Once the download is complete, we'll get started on installing the IDE and we'll take a look at hello and Kotlin. Now that our downloads complete, we can go ahead and onto the installer and I'm Mac. We'll drag the application into our applications folder which will start the install process intelligent IDE community edition. The next thing that wants to do is create our first Kotlin project here in intelligence. So to do that we'll click on create a new project. Now over on the left side of this panel, we'll see a number of different project templates to choose from because we are going to be learning about Kotlin. We want to make sure that we have selected the Kotlin template. Now within this, there are a number of different collie project types that we can 

Let's look at how you can define variables in Kotlin. Now there are two types of variables. In Kotlinwe can define mutable variables, which can have their values reassigned. Those are declared using the VAR keyword. Or we can define local read-only variables, which can have their value assigned only once these are defined using the vow keyword. So to define a variable, we can use the keyword of our choice. So in this case able. Ane and an additional variable. This time we'll say var greeting of type string equals hello. We now have a publicly available top-level variable called greeting. So now if we wanted to come down here and print out a greeting before the name, we could do that by calling print line and passing in greeting.

 We can also modify that greeting because this is a mutable variable and if we then print out this new value, we will see that the message has changed. So when we hit run here, we should now see hello Nate. And then hi mate, let's take a closer look at how variable types are defined. So in defining our variables, in both cases, we use either the voucher or VAR keyword and then we have the variable name. Both of these are 
So let's take a look and alternative means of achieving this functionality. If we come up here to our say hello function, we're going to modify this second. So that is a VAR arch perimeter VAR ARG is a keyword in Kotlin. It essentially represents a variable number of arguments. So in this case, instead of taking a list of string, that by separating them with commas. So it could say Kotlin and now this would be an array of size one. But where the real flexibility comes is we can now start to define many argument values here.

 And so now all of those arguments that's just one example of how you can define anEnon class and then add additional properties and methods that class like you would any other class. Now let's continue refactoring this code to further differentiate between different types of entities. To do that, we're going to leverage sealed class seal classes allow us to define restricted class hierarchies. What this means is that we could define a set one of these, that would be perfectly fine. We could also use object declarations within our seal class hierarchy. So this case will create an object class called help to represent some type of all warn us to work with it, and you're now ready to start taking that knowledge and applying it to other domains.

No comments:

Post a Comment