Hire everyone in this theater Tauriel we're going to go ahead and create our 19th Android application.
And in this story I want to talk about enhanced for loop.
OK.
So let's just create a new Android studio project and here we need to actually specify a name for our
Android application.
So just type in here app 19 and then click on next.
And here we need to actually specify the API 16 Android 4.1 Jelly Bean for minimum STK OK.
And then click on next blank activity next and here click on finish.
OK so now let's actually select this hello world takes you here and then press on delete key on your
keyboard and now it's actually double click on this race folder here and then double click on the folder
and then double click on this activity underline minute example and then select this filleting action
button here and then press undelete key on your keyboard.
OK.
So now let's ask you to go back inside this content underline minute example.
And then I actually double click on these content underline that example tab here in order to make this
area wider.
So now I can actually design my user interface for this application.
OK.
So first of all it's actually like a linearly afterwards they call into this relatively here and then
put this linearly outwards equal at the center of this relatively.
OK so now this is our linear layout.
And then there's actually the right of vertical scroll view into these linearly outward circle.
And now it's actually right a large takes you into this scroll view here.
OK.
So as you can see here this is our text view.
So just double the candlesticks view and then delete the text of this text we have here.
And for the ID just type in here TXI the country names.
OK.
And then press on until key on your keyboard.
So let's actually go back and say this main activity the double file here and then actually delete these
lines of code that are actually related to the Options menu button.
OK.
And then there's actually delete delete this block of code that is actually related to the floating
action button here.
OK.
And now we can actually start putting our own code here.
OK.
So now I want to actually create an army of streambed values.
OK.
But before that let's actually create an object of type text view so takes beauty UTX the country names.
OK.
Assignment operator and then let's actually cast this object to a text view object find view by ID or
that Id dot the country name.
OK.
And then you need to actually put a semicolon at the end of your statement.
And then let's actually create an array of string values.
So first of all I need to actually specify the type of my array and then I need to actually put in a
pair of brackets after my type name in order to specify that I want to create an array.
OK.
And then for the name of this Aure just type in here country names.
OK assignments operator.
And then here inside of these these curly braces I want to actually put some country names.
OK.
So here I just pasting some country names inside of these curly braces here.
So as you can see here these are my country names here as you can see that I actually put in of these
curly braces of this area.
And I notice that I actually put a putting a new line character after each country name here as you
can see by Slash and.
OK.
In order to actually create a new like charity after each country name so that we can actually see these
values on the screen.
OK.
And then I need to actually put in a semicolon at the end of my statement here.
And let's actually create another strange object or keystream and the name of my object is all country
names.
OK.
Assignment operator and then assign an empty value to this object here.
OK.
Now I want you to create a for loop.
OK.
In order to iterate over each of these values each of these string values that are actually the inside
of this country names are.
OK.
But this time I want to actually use an enhanced for loop.
So in order to create an enhanced for loop.
First of all I need to actually type in for and in say the.
Let's actually create a strange value stream.
And the name of my string object is for example Contarini.
OK.
And then I need to put in a colon here.
OK.
And then I need to actually refer to the name of this country names as a country names.
And then I need to open and close this by using these curly braces.
So as you can see here in sight of this prentices I actually created first of all a string object or
case containing colon country names.
In this way it can actually either get is right or that each of these values that are actually inside
of these country names.
OK.
It's going to be either 8 sequentially or they're every each of these values that are actually inside
of these country names.
And then it's going to actually assign that value to this country name object here to this country in
a radio but so here inside of this for loop I can just typing all country names.
OK assignments operator all country names plus country name.
OK so now here again just after this follow up after the end in calibers of this for loop I can just
type in the country names that set text and inside Apprentice's.
I can't just refer to the name of this ol country names object here as I can see all country names.
And now it's actually not.
I'll protect and see what happens.
OK.
Now as you can see our application is actually running on this emulator.
And here you can see these values here.
Outputted actually to the screen and we can actually scroll down the screen to see the other values.
OK.
And these are actually the values that are actually inside of these country names Auret and here and
here we actually created a loop here as you can see in line twenty eight.
In order to either eight or each of these values that are actually inside of this country names are
8 and then it's going to assign each of these values to this country name or object.
And here inside of this for loop we're actually assigned that value to this all Kultury names are actually
the object here.
OK.
These are valuable and we could actually write this code in another way so I can just comment out this
line of code here.
And I will just type in here.
All country names plus equals Contarini.
OK.
And if I run my project again let's see what happens.
So now as you can see again we can see these values here.
OK.
And we can actually scroll down the screen in order to see the other values.
So this is how you actually use the enhanced for loop.
So I think that's enough for this whole deal.
And if you have any questions please post the discussion in the course and then I'll do my best to answer
all of your questions.
Thank you very much for watching and I'll see you in the next tutorial.