Welcome back in this video, we're going to create a new project which is going to be built using jetpack
compose.
So here on the new project, you can just select empty compose activity and it will generate the jetpack
compose code for you.
So I'm going to call this application doc profile.
Page, and you can see that the package name is going to be used or tutorials to talk profile page.
I have the safe location as well as something very interesting is that the language is said to Scotland
and I cannot change it.
And that is because we're using jetpack compose entities limited to Scotland and is not built for Java.
Then we have the minimum SDK of being API 21.
So let's go ahead and create the project.
This will take a little while, and once it's done, the files will be ready.
But let's already look at our main activity, thought Katie.
So we have our main activity class, which is inheriting from component activity, and it has an on
create method, as we would have even without jetpack compose, just using the old fashioned approach
while we call the super method.
And then we set the content to use our torque profile page theme.
So let's not focus on this part.
For now, however, let's look a little further down.
We can see that we have composable here.
So this main activity, Kate File, not only has the main activity class in it, but it also has a couple
of composable seen here in this case, the greeting composable and the default preview.
So let's look at this greeting composable, as you can see, it contains a text composable text is a
composable and can also be referred to as a UI element for any composable.
It must be referenced from another composable.
That is why the greeting function has the composable annotation.
So here it is at composable is an annotation.
And if we get rid of it, for example, we will see that we get an error because this text here is also
a composable so you cannot use compose the balls inside of normal functions.
The functions themselves need to be composable as well.
The main activity also contains other built in composable the set content, for example.
So if we go up here this year is also a composable.
Which declares the UI contents to the activity.
The doc profile page theme, which is created using the name given during the project creation with
a theme attached at the end.
This is used to provide the look and feel of our application so you can go over to your projects now
and open up UI theme.
And there you will find that you have the theme Caity file in UI theme.
You can only see your theme key file, but you can also see the type, the shapes and the colors.
These were also files automatically created for us.
We will be talking about theme in detail in later lectures.
Every project needs an activity to serve as the entry point into the application, which is why we have
a manifest file where this activity is defined, which is the entry point to our application.
So let's look at this file real quick.
We can see it is an XML file, so it's using the XML language, so to speak.
We have the manifest keyword and then inside of it, we have the application.
So here are some parameters that are defined for our application.
And then we have the activity that is defined here, and you can see it is the main activity.
That's the name of it.
And it is using a certain theme, which is the dog profile page, no action bar theme and you could
jump over to it.
It's under your themes exim l file if you wanted to know more about it.
So there are just two items in there which says the window action bar is false and window null.
Title is set to true, so it activates the action bar, but it makes sure that that no title is set
to true.
OK, so this themes XML file, by the way, is found under your resources, values, themes, SML.
So there are even some more files that were automatically generated.
You can see there is this color is expel the strings of XML, which were created for us some drabble
files, as well as some MIP maps.
We're going to go over those and use those different files over the period of this course.
But now let's go back to our Android Manifest ex email.
So we have the intent filter, which basically just handles which activities to open up and how to jump
from one activity to another, for example.
So what we're saying here is when we open up the application, we want to use this activity because
the action is the main action.
And then the category is that this is the launcher activity.
Basically, when we are launching our application, it will launch this activity, which will be our
main activity.
And currently, that obviously makes sense because we only have one activity.
But what if we have multiple screens in the future?
Well, then it would make sense to obviously know in which activity will want to get started with.
So if you have a log in activity, for example, so a login screen and then you have a screen where
you see the details for your particular user account that you logged in.
It would make sense to see the login screen first before you can actually get to your data, right?
Because otherwise you could see the data of a user that is not you.
So that is definitely something you need to take into consideration when building applications, and
we are going to consider that, obviously.
OK, so that's the general structure of our application.
So we have our main activity, which sets the content with composable.
We have a composable here at the bottom, which says greeting at the text and then we have a preview
of our application so we can see how this would look in the preview, but therefore would need to at
least build the application once.
So let's run it real quick and build it, because otherwise the designer will not show us anything.
So here at the top, you can see you can go to your code.
You can split the screen so you see the code and the designer.
Or you can jump to this.
The designer only.
OK.
So we have this text which just says hello and name.
And then here we call this method greeting, which says greeting with the name of Android.
So it's going to show the text of Hello, Android.
OK, so.
Once the application is installed, we can see it here and it says hello, Android at the top left corner,
which is basically this text here.
So now please go ahead and replace this android with your own name.
So this place?
Hello, and then your name?
OK.
I hope you tried it.
It should basically be, in my case.
Hello, Dennis.
So I'm calling this greeting composable function, which is this greeting function right here, and
I'm passing the name, which is a string called Dennis to it.
And it's going to set this text composable to have the property of text say hello.
And Dennis.
So let me rerun it real quick.
And you can see it says, Hello Dennis here.
And by the way, you can also go to your designer and you can see how your application will look like
here.
But as there is really not much happening in our application, it just says Hello, Android.
So this is the default preview that we get through this function right here, which is using the preview
annotation.
So this is our starting point, and you're going to learn a lot more about what's up in this Android
manifest along the way.
You're going to learn how to use themes and how to create your own composable to change the user interface
to your liking.
So that's it for this video.
See you in the next one.