Hire everyone in this theater you are really going to go ahead and actually create our seventh Android
application.
So just click on this.
Start a new Android studio project and for the application name just type in here app 7 and then click
on next and then choose the output API 16:4 your minimum STK next and black Planche activity next.
And here click on finish.
OK everyone.
Now as you can see here our project is created.
So let's just delete this hello or text you here and then let's just actually delete these floating
action button here.
So double click on this address for the here and then lay out and then double double click on this activity
on the line made that example.
And here's the list these are floating action button here.
OK.
So now let's actually go back and say this content underline made that example and then dragging a linear
layout vertical OK.
Inside this screen and in the center of the screen.
So let's actually click on this relatively out here and let's actually find the padding attributes for
this relatively out and for the are actually assigned number 0.
And here as you can see now the beats at the height of R are linearly Ellsworth's the code is actually
covering the the entire screen.
OK.
So let's actually try again a text you are large takes you into this linearly out here and then actually
double click on this text.
And for the text you can just assign a text here for example.
For example you can just put in start and for the ID just type in here to the start.
And let's actually dragging about in here.
So let's just find the bottom component here and then break it here and double click on the spot.
And for the text just typing here start the loop and for the ID just type in between loop and as you
can see here I want to actually put a space between these two components.
This takes you on the spot and again just dragging on top a large takes you here in between these two
components.
I can just delete the text of this text you and then I can just find the Margene attribute for this
takes you here.
So as you can see this is the margin attribute and for the margin I can just assign number 20 here.
So as you can see there is a difference between these two components here.
OK.
So now let's actually go inside this main activity that you will find here.
And let's actually delete these lines of code here.
It is lines of code too because these are actually related to the floating action button.
And here let's actually create a text view object text through the XTi start and then I can just cast
this object to a text view object.
OK.
Find you by ID are that Id dot the X the start and the button button and loop assignment operator button
find you by ID or that Id dot PTEN loop.
So now let's actually make it important to listen to the clicks that the user make.
So I can't just type in PTEN loop that set and click listen a new view that actually listen or OK.
So now here let's actually create a for loop in this tutorial.
I want to actually show you the full up how you can actually create four loops in Java so I can just
type in four and then I can actually put in a pair of round brackets here and then in order to start
the loop I can't just create a variable here so I can't just take it in ain't I.
Assignment operator zero.
So as you can see here first of all I actually created a valuable.
OK.
And then I assign numbers not numbers 0 to this value.
OK.
Now I need to actually specify when my loop is going to is going to end.
So I can just type in until I is listable equal to number 10 and then I need to put in a semicolon here
and in here I need to actually specify that what happens whenever this loop executes.
You want the value of this.
Are you valuable to actually to be increased by 1.
OK.
And then I need to open and close this two for using these curly braces.
So here I can just type in the start that said text.
And now inside the practice's I can just refer to the name of this variable.
And then because this is actually of type Integer.
And and here we're are actually assigning an integer number to this at the start of we need to actually
convert this value to a string value by actually putting a plus operator and then or two or two double
quotes here.
OK so now let's actually run our application and see what happens.
So now as you can see our application is running.
And if I click on the spot in here as you can see it says number 10.
OK.
When I click on this button here OK this loop is going to be executed 10 times.
OK.
First we actually specified are valuable and then we specified in our loop is going to end actually
until it is less than or equal to number 10 and plus plus.
And here in this piece of code actually specifies what happens after each execution of a for loop or
this piece of code is going to be executed.
A-plus plus.
OK.
So as you can see Number 10 is here.
OK.
So now I want to show you the while loop.
So now let's actually comment out these lines of code here.
OK everyone.
Now I want to talk about why loop so I can just type in a while and then I put a pair of round brackets
here and now I need to actually specify the condition in which the divide is going to be executed.
So first let me actually create a variable here ain't I.
And then I actually assign a value to my valuable.
For example number zero.
And here in say the prentices I can just type in I is less than or equal to number two number 10.
OK.
And then I need to actually open and close my while loop by using these curly braces.
So as you can see here first of all I actually created a variable of type integer and then inside the
parentheses here I actually specified very my while loop is going to be and that OK.
And now inside these are curly braces I need to actually specify what's going to happen in each execution
of this while loop.
So now I can just type in to the start that said text and then say the prentices.
OK just leave it with the name of this I are valuable here plus two double quotes.
OK here I am actually converting this value bet the value of this variable to a string value.
And now we need to actually increase the value of this variable by one in each execution of these two.
OK so I.
Plus plus.
So let's run our project and see what happens.
So now if you actually click on this pattern here start the loop as you can see it says Number 10.
OK here it's going.
It is actually executing this while loop 10 times.
OK.
And then it is actually executing these lines of code in the inside of this while loop.
OK.
So this is how you actually create a while loop in your project.
OK.
So now I want one actually talk about the do while loop.
OK.
So first let me actually comment out these lines of code here and now I again just type in.
OK.
And then I actually open and close my statement here by using these curly braces.
And then here at the end of this ending curly brace I can just type in wide and then I need to put in
a pair of round brackets after my white statement here.
OK.
That is why we're here.
And then inside of this prentices I can specify the condition.
Ok for example.
First let me actually create another variable for example in y.
Assignment operator zero and here here just specify the condition.
So I can't just typing until Y is less than or equal to number 15.
OK.
And then I need to actually putting a semi-colon at the end of my statement.
So now I get it here I get inside this do our statement here I can't just typing in the start that said
text y ok.
And then I need to actually increase the value of this variable by 1 in each execution of these do while
loop.
So now let's actually run our project and see what happens.
OK.
Now let's actually click on this.
Start the loop plotted here.
And as you can see here our application crashed as you can see.
The problem is we didn't actually convert this up valuable to a string value by using these but using
this plus operation.
And then these two are double quotes and let's actually do our project again.