Hired Livan in this theater they are all going to go ahead and create another Android application.
So just click on this.
Start a new Android studio project here and then for the name of our application just type in here app
55 and then click on next and here choose API 16 Android 4.1 Jelly Bean and then click on next and here
choose empty activity next and then click on finish.
So now as you can see here our product is actually created.
So let's actually go inside our rest folder and then double click on the layout directory here.
So now click and this activity underline main example and here at the bottom or just click on the Design
tab here.
So now as he has said here we want to actually design the user interface of our application.
So just a select is hello world view here and then press on delete key on your keyboard.
So now in this tutorial I want to talk more about the example files in Android.
So just click on this layout folder here at this directory right click on it and then you and then click
on layout resource file.
So now I want to actually create an include file in my project so just type in here include include
excuse me include underline and then here you can you can actually type a text underlined a button underline
checkbox
underline panel.
OK.
And then the root element should be a linear layout and the sort of said Main and the directory name
lay out and here click on.
OK.
So as you can see here it's actually a glitch and these include file here and actually design the user
interface of this file of this XML file.
So let's actually go inside this takes a tab here just click on the text tab.
And as you can see here this is actually these are the the example lines of code that are actually related
to art exemplified.
OK.
So the orientation is vertical.
So as you can see here the root element is linearly out there.
The orientation is vertical.
The layout is much parent and the layout height is much Pallant So the layout we should be wrapped content.
Okay wrap content and the layout height also should be wrapped content.
So now inside is linearly out here.
I want to actually put Arctic's or takes you inside these linearly out.
So let me actually double click on this tab here in order to make this area Vider.
So now I am actually inside this linear layout and I want to create a text view.
So I just need to type in text view and for the layout Viets I can't assign a value.
For example 200.
OK.
And for the lay out height I can assign the value 200 dpi.
OK.
So now let's actually assign our text to the state's view.
So here I can't just type in text.
So now I just need to select this android call and text here.
This takes attributes.
So for the text just typing here this is text.
OK.
And then I can actually assign an ID to the state's view.
So Id is going to be at sign Plus Id slash.
So now I can actually assign an ID to the States view.
So here I can just say Pontiac's the include and here as you can see this is our takes.
View OK.
So now I don't to actually create a button here.
So again I just need to type in.
I just need to actually open a tag here and then typing Potin and for the layout read assigned a value
of 100 DP and for the layout height assigned a value of 100 DP.
OK.
And here let's actually assign a text value to this button so I can just type in text and now I can
actually assign a text to the spot to this spot.
And so here I can just say indices mean this is button.
And here I can actually assign an ID to this button so I just need to type in ID.
And here I just need to select this and do it call an idea here and then press enter key on your keyboard
and then here just type in front plus ID slash.
OK.
So I just need to select the first recommendation as you can see here at St. plus read slash and then
I can actually assign an ID to this button.
So the idea is going to be between include.
Now I want to actually create a checkbox inside my linear layout so the checkbox is going to be.
So I just need to open a tag here and I just need to type in checkbox and the layout which is going
to be for example 300 dpi and the layout height is going to be three hundred deep.
OK.
Or I can actually assign the value or wrap content for the layout or wrap and love content for the layout
height and I can actually assign a text to this checkbox so the text is going to be this is checkbox
and then I can actually assign an ID to the same box so the checkbox is.
So the idea is going to be at same place Id slash.
And here I can't just type in C-h X includes.
OK.
So as you can see here I have a text view and a button and the checkbox inside my linearly out here.
OK so now as I can see this is this is actually my include Right.
So let's see how we can actually use this file in our activity underline minute example here.
So there are two ways that you can actually use your include while in your activity underline main that
example.
So first of all the first one is actually inside this Design tab.
So as you can see here at the left hand side here as you can see we have these user interface components.
So just scroll down here and inside is custom folder as you can see we have some components here.
So just a selectees include file here as you can see include.
And here we can actually search for your include file.
So here I can just type in include an underline text underlined button underlined checkbox.
So this is my include file.
I just need to select it and then click on OK.
So as you can see here now I have actually selected my last fight so I can put it at the center of my
relatively old here.
So now as you can see this is my include file.
I have a text view.
This is text.
I have a button this is button and I have a checkbox.
This is checkbox.
OK.
So these are the user interface components that I actually put inside my include file.
And then inside my activity underline main that examen I can actually add these include file or keep
in sight my activity underline me in that example.
OK.
So just select these include file here and then press handle on your keyboard.
So let's actually click on this text tab here at the bottom.
So now I want to actually add these include file here inside my relatively out.
So here I can just open attach here and then just typing a include as you can see here include and then
select include here and then press on space key on your keyboard and then just type in here layout.
So here they lay out as you can see now I can actually select the layout so that the layout is going
to be might include five includes the length takes on the length.
What an underlined checkbox.
So just select this one and then press enter key on your keyboard and then enter this tag here.
So now if we are actually at the right hand side as against here we have this preview here.
So if I click on this preview here now we can actually see this include file here or I can actually
change to switch to design type here as you can see.
Now as you can see this is our include file here.
OK.
So now let's see how we can actually use this include file in our Java codes.
OK.
So now in our project structure as you can see inside this job folder and inside this package I want
to actually doubleclick on this main activity here main activity that double file.
And now now I want to actually use my user interface components that are inside my include file.
OK so as you can see here inside this file inside these include underlined text underlined button underlined
checkbox underlined panel that example.
I actually put these user interface components takes view a button and a checkbox and then I assign
an ID to every each of these user interface components.
So here inside this main activity that of a file here now I can actually use this.
I can actually refer to those are user interface components.
And then I can use them.
So inside is uncreate Mefford.
I want to actually declare some objects and I want to actually initialize those objects.
So first of all I have actually a text view in say This includes file.
Right.
I have this text view.
So now I want to actually declare and create an object of type text view.
So you and the name of my object is going to be the include assignment operator and then here I need
to actually cast this object to a text view object find view by ID or thought Id dot the include.
And then I need to put a semicolon at the end of my statement and here as you can see again inside this
includes file I have this button right.
So inside this main activity that of a file I can actually create a button Sabaton PTEN include assignment
operator and then here I need to cast this object to a button object find view by ID are thought Id
thoughts PTEN include.
OK.
And then I need to actually put a semicolon at the end of my statement.
So inside this includes file as you can see we have also a checkbox here.
So let's actually create a checkbox here.
Now I can just type in checkbox and the name of my object is going to be c h x x x.
Include assignment operator and then here I need to cast this object to a checkbox object find view
y id are that I did not see it checks include and then I need to put a semicolon at the end of my statement.
So here I can actually make disputant this.
See this.
Or better yet include a listener particularly of the user.
So I can just type in between and include that sets unclick listener as you can see here new view.
So here I want to actually create an inner class an anonymous inner class so new viewed that unclick
listener.
So here is inside this in a class as you can see it is in it because it's actually implementing this
view that unclick less than an interface and it is going to actually overwrite this man of faith here.
OK.