But now I want to actually generate for example more than one random number here.
OK.
And then I'm going to make the Spartan invisible.
So in order to do that first of all let me point out that here we created an if statement here.
OK.
And we specified that if the length of this value is more than or equal to number nine then it's going
to actually make this button invisible.
Ok make this generates secure random numbers in this event.
And here in this line of code in line 62.
I am actually getting the value of this secure random numbers.
OK.
And then I am actually converting this value to a string value and then I am assigning that value to
this string object all TXI the secure random numbers.
So I actually are getting the old value here and I am putting that value here.
OK.
For example this number four is the old value and if you want to click on this button again or you want
the next value.
The next number to be beside of this number here number four.
OK.
So here in order to do that I can just typing inside this prentices I can just type in old TXI the secure
random numbers value plus random secured number.
So let's actually run our project again and see what happens.
OK.
Now as you can see our application is actually running on the emulator.
So let's actually click on this generate secure random numbers.
Number three let's actually click on this button again Firstly free to 4.
Ok 1 1 5 2 4 2 and finish.
As you can see it actually has generated this and that these are not random numbers.
And now our button is invisible so we cannot do anything here.
Or you can just click on this button again because we make this button invisible.
So let me explain again.
So now let me explain again what's going on here.
OK so first of all we created a boolean variable.
OK.
Inside this main activity class.
OK.
So we made this but valuable private.
So this variable is only visible inside the scope of this class only.
OK.
And then we assigned the value true to our value of it.
And inside this set unclick listener of this PTEN secure random number as you can see.
Let's actually run our project again because I want to show you some important points.
So as you can see here now this is our application is running.
For the first time for example on our emulator and this is our button and this is our view here secure
random numbers are because we actually created a boolean variable here and we assign a value to to our
variable here inside this these are pretty secure random numbers that set up like this and here as you
can see when I actually click on this spot and it's going to actually execute the lines of code that
are inside of this on my feet.
OK.
So first if I click on this button it's going to actually execute this up block of code here.
If first time this means that if the value of the first time value is true.
So it is true OK if the value of this first thing valuable is true then it's going actually as scientists
empty value to our Takes view here.
OK.
So and then it's going can actually assign the value falls to this value bet.
So let's actually click on the spot in as you can see it assigned the value empty.
Here is a text from you and then it actually assign the value falls to this valuable.
So this block of code is not going to be executed anymore.
OK.
Because the value of this first thing variable is false.
So if I click on this button here again it's not going to actually execute this block of code here.
OK.
As you can see it didn't execute this block of code and it's going to actually after executing this
block of block of code it's going I should execute these others these other block lines of code here
as you can see.
First it's going to actually create a secure random number object and then it's going to actually create
a string value a strange object and then it's going to get the value of this text view here and then
it's going to assign that value to this variable here.
OK.
It can actually get the value of this text view as you can CTX the secure random numbers that get text
that restraint is going to actually get this value and then assign that value to this strange object.
And here we created another if statement and we said that if the value of these t XTi secure random
numbers here as you can see the value of this text you if the length of this text view is actually greater
than or equal to number 9 then it's going to actually execute this line of code here.
It's going to make this pattern invisible.
OK.
So as you can see here you've got two characters here.
So this button is still visible.
OK so this line of code is this block of code is not actually get executed yet and it is going to actually
execute these lines of code here.
It's going to actually create a random secure number starting from the value of one.
And number five and it ends actually with number five.
OK.
So number one.
And number five.
And then we actually decided to output this value to the log.
OK.
So it's going to output this value to the lock and we can see those are random secure numbers.
And here in 1969 we decided to output these values to the screen.
And here we get the old tricks to secure random numbers value.
OK.
So as you can see for example this is the old value.
OK.
And we are assigning that value to this object.
So you actually put this value here plus random secure number.
So random security number is the newest random number that it actually generated for us.
OK.
So let's actually click on this button again.
Free to free this free.
Here is the newest value as you can see this one is the news value.
So these are free numbers here.
Free to free is the old value.
OK.
And this is the old all the secure random numbers here.
OK.
And here.
And so on.
And then it's going to make this button invisible.
So it actually Executive this if statement here.
OK.
So whenever you actually click on this button it's going to actually execute these lines of code here.
So you should actually always consider this in all of your programs.
OK.
So hopefully that makes sense.
Ok everyone.
Now I want to talk about two important points about this project.
First of all as you can see here we created a billion valuable first time here and we actually signed
the value true to our value.
So why did I actually created this variable here inside of this class and not in sight of this unclick
comfort.
And the reason for that is because I want this value to be present for the entire life of my application.
OK.
When the user starts my application I want this app this valuable actually gets created and I want to
actually manipulate the value of this variable inside of these assets click listen listener.
We created an if statement here and then we actually said that if the value of this first time variable
is true executes this line of code here takes the secure random numbers the set text is empty value
and then assign the value falls to this value.
So when I actually assigned a value to this valuable.
OK.
As you can see we created this variable here inside of this class.
And when I actually assign the value false to this valuable This means that the value of this first
time valuable is going to be false throughout the entire application unless I actually change that value
somewhere else in my code.
But when I actually assign the value false to this valuable it is going to be false for the entire lifetime
of my application.
Lifetime means that when the user actually starts the application till the user actually ends the application.
OK.
This is the one important point because I want this value for throughout the entire application.
I needed to create this app this variable inside the class because I wanted to actually manipulate the
value of this variable somewhere else in my code in one of my methods and that I wanted that value to
be present throughout the entire lifetime of my application.
OK.
So when you create a valuable inside one of your methods such as Uncle Smurfette or another method that
has this get maximum here when you create a variable the life of that variable is actually dependent
to that actually curly braces of that method.
OK.
When that method is executed that are actually valuable is going to be eliminated.
OK that's the end of the life of that variable.
So the life of this variable is actually dependent to this method.
OK.
So this variable is local variable and we cannot actually use this variable from other methods or other
places of this class that are inside of this class.
So we cannot this variable the value of this valuable because this is a local variable.
OK.
And this variable is only alive in this method.
We are actually referring to the name of this get the maximum Meffert.
OK.
But as you can see here we refer to this method and.
And it can actually go inside of this method.
And then as you can see it's going to actually execute these lines of code inside of this Meffert.