1
00:00:00,510 --> 00:00:05,740
But now I want to actually generate for example more than one random number here.

2
00:00:05,910 --> 00:00:06,220
OK.

3
00:00:06,240 --> 00:00:09,790
And then I'm going to make the Spartan invisible.

4
00:00:10,080 --> 00:00:16,670
So in order to do that first of all let me point out that here we created an if statement here.

5
00:00:16,770 --> 00:00:17,350
OK.

6
00:00:17,550 --> 00:00:24,300
And we specified that if the length of this value is more than or equal to number nine then it's going

7
00:00:24,300 --> 00:00:26,580
to actually make this button invisible.

8
00:00:26,890 --> 00:00:30,300
Ok make this generates secure random numbers in this event.

9
00:00:30,480 --> 00:00:33,770
And here in this line of code in line 62.

10
00:00:34,020 --> 00:00:38,320
I am actually getting the value of this secure random numbers.

11
00:00:38,460 --> 00:00:39,070
OK.

12
00:00:39,390 --> 00:00:44,760
And then I am actually converting this value to a string value and then I am assigning that value to

13
00:00:44,760 --> 00:00:48,620
this string object all TXI the secure random numbers.

14
00:00:48,630 --> 00:00:54,760
So I actually are getting the old value here and I am putting that value here.

15
00:00:54,920 --> 00:00:55,360
OK.

16
00:00:55,440 --> 00:01:01,710
For example this number four is the old value and if you want to click on this button again or you want

17
00:01:01,710 --> 00:01:04,000
the next value.

18
00:01:04,020 --> 00:01:07,220
The next number to be beside of this number here number four.

19
00:01:07,320 --> 00:01:08,010
OK.

20
00:01:08,340 --> 00:01:16,200
So here in order to do that I can just typing inside this prentices I can just type in old TXI the secure

21
00:01:16,200 --> 00:01:21,090
random numbers value plus random secured number.

22
00:01:21,120 --> 00:01:25,700
So let's actually run our project again and see what happens.

23
00:01:25,710 --> 00:01:26,290
OK.

24
00:01:26,340 --> 00:01:31,500
Now as you can see our application is actually running on the emulator.

25
00:01:31,500 --> 00:01:36,780
So let's actually click on this generate secure random numbers.

26
00:01:36,780 --> 00:01:43,880
Number three let's actually click on this button again Firstly free to 4.

27
00:01:44,280 --> 00:01:50,970
Ok 1 1 5 2 4 2 and finish.

28
00:01:51,060 --> 00:01:55,860
As you can see it actually has generated this and that these are not random numbers.

29
00:01:56,160 --> 00:02:00,600
And now our button is invisible so we cannot do anything here.

30
00:02:00,810 --> 00:02:05,040
Or you can just click on this button again because we make this button invisible.

31
00:02:05,160 --> 00:02:06,720
So let me explain again.

32
00:02:06,720 --> 00:02:09,800
So now let me explain again what's going on here.

33
00:02:09,890 --> 00:02:13,290
OK so first of all we created a boolean variable.

34
00:02:13,410 --> 00:02:14,010
OK.

35
00:02:14,220 --> 00:02:16,030
Inside this main activity class.

36
00:02:16,050 --> 00:02:16,470
OK.

37
00:02:16,530 --> 00:02:19,540
So we made this but valuable private.

38
00:02:19,920 --> 00:02:24,730
So this variable is only visible inside the scope of this class only.

39
00:02:24,810 --> 00:02:25,260
OK.

40
00:02:25,320 --> 00:02:28,810
And then we assigned the value true to our value of it.

41
00:02:29,250 --> 00:02:35,560
And inside this set unclick listener of this PTEN secure random number as you can see.

42
00:02:35,670 --> 00:02:41,700
Let's actually run our project again because I want to show you some important points.

43
00:02:41,850 --> 00:02:45,090
So as you can see here now this is our application is running.

44
00:02:45,090 --> 00:02:52,560
For the first time for example on our emulator and this is our button and this is our view here secure

45
00:02:52,560 --> 00:02:58,770
random numbers are because we actually created a boolean variable here and we assign a value to to our

46
00:02:58,770 --> 00:03:05,340
variable here inside this these are pretty secure random numbers that set up like this and here as you

47
00:03:05,340 --> 00:03:12,240
can see when I actually click on this spot and it's going to actually execute the lines of code that

48
00:03:12,240 --> 00:03:14,340
are inside of this on my feet.

49
00:03:14,580 --> 00:03:15,170
OK.

50
00:03:15,540 --> 00:03:20,880
So first if I click on this button it's going to actually execute this up block of code here.

51
00:03:20,890 --> 00:03:26,630
If first time this means that if the value of the first time value is true.

52
00:03:26,880 --> 00:03:32,670
So it is true OK if the value of this first thing valuable is true then it's going actually as scientists

53
00:03:32,730 --> 00:03:35,000
empty value to our Takes view here.

54
00:03:35,190 --> 00:03:35,760
OK.

55
00:03:35,940 --> 00:03:41,380
So and then it's going can actually assign the value falls to this value bet.

56
00:03:41,400 --> 00:03:48,320
So let's actually click on the spot in as you can see it assigned the value empty.

57
00:03:48,540 --> 00:03:53,610
Here is a text from you and then it actually assign the value falls to this valuable.

58
00:03:53,700 --> 00:03:56,850
So this block of code is not going to be executed anymore.

59
00:03:57,140 --> 00:03:57,710
OK.

60
00:03:57,720 --> 00:04:01,310
Because the value of this first thing variable is false.

61
00:04:01,440 --> 00:04:07,550
So if I click on this button here again it's not going to actually execute this block of code here.

62
00:04:07,590 --> 00:04:07,830
OK.

63
00:04:07,830 --> 00:04:13,710
As you can see it didn't execute this block of code and it's going to actually after executing this

64
00:04:13,710 --> 00:04:19,860
block of block of code it's going I should execute these others these other block lines of code here

65
00:04:19,980 --> 00:04:20,920
as you can see.

66
00:04:21,150 --> 00:04:29,730
First it's going to actually create a secure random number object and then it's going to actually create

67
00:04:30,000 --> 00:04:37,710
a string value a strange object and then it's going to get the value of this text view here and then

68
00:04:37,710 --> 00:04:40,470
it's going to assign that value to this variable here.

69
00:04:40,500 --> 00:04:41,010
OK.

70
00:04:41,050 --> 00:04:47,540
It can actually get the value of this text view as you can CTX the secure random numbers that get text

71
00:04:47,550 --> 00:04:53,570
that restraint is going to actually get this value and then assign that value to this strange object.

72
00:04:53,970 --> 00:05:02,600
And here we created another if statement and we said that if the value of these t XTi secure random

73
00:05:02,600 --> 00:05:10,820
numbers here as you can see the value of this text you if the length of this text view is actually greater

74
00:05:10,850 --> 00:05:16,980
than or equal to number 9 then it's going to actually execute this line of code here.

75
00:05:17,060 --> 00:05:19,260
It's going to make this pattern invisible.

76
00:05:19,400 --> 00:05:19,840
OK.

77
00:05:19,970 --> 00:05:22,880
So as you can see here you've got two characters here.

78
00:05:22,880 --> 00:05:24,700
So this button is still visible.

79
00:05:24,860 --> 00:05:33,080
OK so this line of code is this block of code is not actually get executed yet and it is going to actually

80
00:05:33,110 --> 00:05:34,880
execute these lines of code here.

81
00:05:35,030 --> 00:05:40,300
It's going to actually create a random secure number starting from the value of one.

82
00:05:40,300 --> 00:05:43,520
And number five and it ends actually with number five.

83
00:05:43,580 --> 00:05:44,180
OK.

84
00:05:44,360 --> 00:05:45,930
So number one.

85
00:05:46,400 --> 00:05:47,480
And number five.

86
00:05:47,510 --> 00:05:53,120
And then we actually decided to output this value to the log.

87
00:05:53,360 --> 00:05:53,990
OK.

88
00:05:54,320 --> 00:05:59,510
So it's going to output this value to the lock and we can see those are random secure numbers.

89
00:05:59,720 --> 00:06:05,450
And here in 1969 we decided to output these values to the screen.

90
00:06:05,720 --> 00:06:10,120
And here we get the old tricks to secure random numbers value.

91
00:06:10,310 --> 00:06:10,760
OK.

92
00:06:10,910 --> 00:06:13,380
So as you can see for example this is the old value.

93
00:06:13,400 --> 00:06:13,990
OK.

94
00:06:14,240 --> 00:06:17,120
And we are assigning that value to this object.

95
00:06:17,150 --> 00:06:21,470
So you actually put this value here plus random secure number.

96
00:06:21,650 --> 00:06:28,040
So random security number is the newest random number that it actually generated for us.

97
00:06:28,430 --> 00:06:29,020
OK.

98
00:06:29,300 --> 00:06:31,970
So let's actually click on this button again.

99
00:06:31,970 --> 00:06:33,980
Free to free this free.

100
00:06:33,980 --> 00:06:38,810
Here is the newest value as you can see this one is the news value.

101
00:06:38,810 --> 00:06:40,740
So these are free numbers here.

102
00:06:40,760 --> 00:06:42,890
Free to free is the old value.

103
00:06:42,920 --> 00:06:43,350
OK.

104
00:06:43,430 --> 00:06:46,550
And this is the old all the secure random numbers here.

105
00:06:46,760 --> 00:06:47,640
OK.

106
00:06:48,260 --> 00:06:49,110
And here.

107
00:06:49,400 --> 00:06:50,040
And so on.

108
00:06:50,060 --> 00:06:52,610
And then it's going to make this button invisible.

109
00:06:52,610 --> 00:06:55,600
So it actually Executive this if statement here.

110
00:06:55,640 --> 00:06:56,010
OK.

111
00:06:56,090 --> 00:07:01,170
So whenever you actually click on this button it's going to actually execute these lines of code here.

112
00:07:01,400 --> 00:07:06,000
So you should actually always consider this in all of your programs.

113
00:07:06,020 --> 00:07:06,740
OK.

114
00:07:07,100 --> 00:07:09,840
So hopefully that makes sense.

115
00:07:09,890 --> 00:07:10,850
Ok everyone.

116
00:07:10,850 --> 00:07:16,120
Now I want to talk about two important points about this project.

117
00:07:16,130 --> 00:07:22,460
First of all as you can see here we created a billion valuable first time here and we actually signed

118
00:07:22,520 --> 00:07:24,170
the value true to our value.

119
00:07:24,320 --> 00:07:32,380
So why did I actually created this variable here inside of this class and not in sight of this unclick

120
00:07:32,390 --> 00:07:33,090
comfort.

121
00:07:33,410 --> 00:07:42,080
And the reason for that is because I want this value to be present for the entire life of my application.

122
00:07:42,260 --> 00:07:42,690
OK.

123
00:07:42,710 --> 00:07:50,600
When the user starts my application I want this app this valuable actually gets created and I want to

124
00:07:50,600 --> 00:07:57,250
actually manipulate the value of this variable inside of these assets click listen listener.

125
00:07:57,290 --> 00:08:04,130
We created an if statement here and then we actually said that if the value of this first time variable

126
00:08:04,130 --> 00:08:09,830
is true executes this line of code here takes the secure random numbers the set text is empty value

127
00:08:10,190 --> 00:08:12,610
and then assign the value falls to this value.

128
00:08:12,800 --> 00:08:16,000
So when I actually assigned a value to this valuable.

129
00:08:16,100 --> 00:08:16,360
OK.

130
00:08:16,370 --> 00:08:20,350
As you can see we created this variable here inside of this class.

131
00:08:20,600 --> 00:08:26,900
And when I actually assign the value false to this valuable This means that the value of this first

132
00:08:26,900 --> 00:08:33,590
time valuable is going to be false throughout the entire application unless I actually change that value

133
00:08:33,740 --> 00:08:35,180
somewhere else in my code.

134
00:08:35,330 --> 00:08:42,290
But when I actually assign the value false to this valuable it is going to be false for the entire lifetime

135
00:08:42,290 --> 00:08:43,580
of my application.

136
00:08:43,610 --> 00:08:50,610
Lifetime means that when the user actually starts the application till the user actually ends the application.

137
00:08:50,610 --> 00:08:51,010
OK.

138
00:08:51,110 --> 00:08:55,670
This is the one important point because I want this value for throughout the entire application.

139
00:08:55,820 --> 00:09:04,130
I needed to create this app this variable inside the class because I wanted to actually manipulate the

140
00:09:04,130 --> 00:09:10,560
value of this variable somewhere else in my code in one of my methods and that I wanted that value to

141
00:09:10,580 --> 00:09:14,730
be present throughout the entire lifetime of my application.

142
00:09:14,750 --> 00:09:15,150
OK.

143
00:09:15,290 --> 00:09:21,860
So when you create a valuable inside one of your methods such as Uncle Smurfette or another method that

144
00:09:21,860 --> 00:09:29,720
has this get maximum here when you create a variable the life of that variable is actually dependent

145
00:09:29,810 --> 00:09:32,590
to that actually curly braces of that method.

146
00:09:32,600 --> 00:09:33,130
OK.

147
00:09:33,260 --> 00:09:38,970
When that method is executed that are actually valuable is going to be eliminated.

148
00:09:39,050 --> 00:09:41,560
OK that's the end of the life of that variable.

149
00:09:41,570 --> 00:09:46,260
So the life of this variable is actually dependent to this method.

150
00:09:46,550 --> 00:09:47,010
OK.

151
00:09:47,060 --> 00:09:54,350
So this variable is local variable and we cannot actually use this variable from other methods or other

152
00:09:54,350 --> 00:09:57,780
places of this class that are inside of this class.

153
00:09:57,860 --> 00:10:03,170
So we cannot this variable the value of this valuable because this is a local variable.

154
00:10:03,190 --> 00:10:03,660
OK.

155
00:10:03,800 --> 00:10:07,010
And this variable is only alive in this method.

156
00:10:07,050 --> 00:10:10,820
We are actually referring to the name of this get the maximum Meffert.

157
00:10:10,830 --> 00:10:11,160
OK.

158
00:10:11,210 --> 00:10:14,140
But as you can see here we refer to this method and.

159
00:10:14,240 --> 00:10:16,990
And it can actually go inside of this method.

160
00:10:17,150 --> 00:10:21,630
And then as you can see it's going to actually execute these lines of code inside of this Meffert.

