1
00:00:00,360 --> 00:00:09,120
So here I can just take Pontiac's the five stars student that said text and inside Apprentice's I need

2
00:00:09,120 --> 00:00:12,520
to just be fair to the name of the five stars review.

3
00:00:12,640 --> 00:00:12,980
OK.

4
00:00:12,990 --> 00:00:15,660
Plus two double quotes.

5
00:00:16,200 --> 00:00:16,920
OK.

6
00:00:17,250 --> 00:00:26,850
Again just typing here takes the Forresters student that said text for star review plus two double quotes

7
00:00:27,500 --> 00:00:39,480
takes the freestylers student that said text free starts review plus two double quotes TXI the two stars.

8
00:00:39,570 --> 00:00:51,540
Student That said text to start a review plus two double quotes takes the one to start student.

9
00:00:51,720 --> 00:00:57,240
That said text one star review plus two double quotes.

10
00:00:57,790 --> 00:01:02,810
OK so now let's actually run our project and see what happens.

11
00:01:02,970 --> 00:01:08,510
So as you can see here our application is actually running on this emulator and here as you can see

12
00:01:08,520 --> 00:01:10,020
it let's actually click on this.

13
00:01:10,020 --> 00:01:11,910
Show me the results button here.

14
00:01:11,940 --> 00:01:14,540
In order to see what's the results.

15
00:01:14,550 --> 00:01:15,660
OK.

16
00:01:16,260 --> 00:01:19,960
As you can see here these values are from these student reviews.

17
00:01:19,980 --> 00:01:20,690
OK.

18
00:01:21,060 --> 00:01:26,340
And here we are actually to reading these values and we are saying that we have four students with five

19
00:01:26,340 --> 00:01:27,970
star review.

20
00:01:27,990 --> 00:01:32,020
We have two students with four stars of The View.

21
00:01:32,280 --> 00:01:36,320
We have four students with of The View.

22
00:01:36,570 --> 00:01:43,080
We have two students we have three students with two stars of The View and we have one student with

23
00:01:43,140 --> 00:01:44,650
one star review OK.

24
00:01:44,910 --> 00:01:49,860
And here we are actually reading the values that are actually inside of the students reviews and we

25
00:01:49,860 --> 00:01:51,880
are outputting those values to the screen.

26
00:01:51,960 --> 00:01:52,390
OK.

27
00:01:52,530 --> 00:01:54,340
OK everyone.

28
00:01:54,480 --> 00:01:58,880
As you can see here our application is actually working right here on the simulator.

29
00:01:59,130 --> 00:02:02,130
But are there is a really nasty bug in our application.

30
00:02:02,250 --> 00:02:07,420
If you actually click on this or show me the results button here again let's see what happens.

31
00:02:07,630 --> 00:02:10,070
Oh as you can see the values changed.

32
00:02:10,080 --> 00:02:12,200
Eight for eight.

33
00:02:12,230 --> 00:02:14,280
And again the values changed.

34
00:02:14,460 --> 00:02:15,670
So that's not right.

35
00:02:15,670 --> 00:02:19,560
That's that's a bug in our application that these values should not be changed.

36
00:02:19,560 --> 00:02:25,380
OK because we are reading these values from these of them that are actually inside of these students

37
00:02:25,380 --> 00:02:26,310
reviews.

38
00:02:26,310 --> 00:02:26,860
OK.

39
00:02:27,150 --> 00:02:34,750
As you can see here the problem occurs when this for loop is executed in sight of this of unclick Meffert.

40
00:02:34,770 --> 00:02:35,390
OK.

41
00:02:35,670 --> 00:02:39,990
So when you actually click on this button first of all it's going to actually execute this for a loop

42
00:02:39,990 --> 00:02:40,420
here.

43
00:02:40,530 --> 00:02:41,030
OK.

44
00:02:41,130 --> 00:02:44,210
As you can see here it is inside of this for loop.

45
00:02:44,380 --> 00:02:48,120
We have actually put some if statements here and inside.

46
00:02:48,150 --> 00:02:54,510
And here I am saying that for example if students reviews up in the x is equal to number five plus plus

47
00:02:54,510 --> 00:02:57,870
five stars review then it's going to actually go inside of this array.

48
00:02:57,870 --> 00:03:04,170
And if it finds for example a value that is equal to this number five then it's going to actually increment

49
00:03:04,200 --> 00:03:07,380
the value of this a five star review by one.

50
00:03:07,440 --> 00:03:08,030
OK.

51
00:03:08,160 --> 00:03:11,690
And then it's going to actually outputs that value to that screen.

52
00:03:11,840 --> 00:03:12,300
OK.

53
00:03:12,330 --> 00:03:15,910
So that's why we can see that these values are changing here.

54
00:03:16,050 --> 00:03:16,380
Why.

55
00:03:16,410 --> 00:03:18,900
When we actually click on the spot in here OK.

56
00:03:19,050 --> 00:03:24,660
Because every time that we actually click on the spot and I try to execute this follow up here and then

57
00:03:24,660 --> 00:03:30,090
it's going I try to go inside this follow up and then when it finds a value that is inside of this array

58
00:03:30,410 --> 00:03:36,030
and that video for example is of equal to this number it can actually increment the value of these variables

59
00:03:36,030 --> 00:03:37,010
that we created here.

60
00:03:37,010 --> 00:03:37,540
OK.

61
00:03:37,830 --> 00:03:42,910
And here we are actually outputting the value of these variables to the screen.

62
00:03:43,140 --> 00:03:43,650
OK.

63
00:03:43,710 --> 00:03:46,380
So there are three solutions to this problem.

64
00:03:46,380 --> 00:03:46,900
OK.

65
00:03:47,070 --> 00:03:53,150
The first solution is actually after executing these lines of code after this follow up after this for

66
00:03:53,160 --> 00:03:56,080
loop and after executing these lines of code here.

67
00:03:56,160 --> 00:03:56,620
OK.

68
00:03:56,730 --> 00:04:06,690
So here I just into typing between results that said visibility view that invisible.

69
00:04:06,930 --> 00:04:12,730
So now as you can see here I am actually putting this line of code here after executing these lines

70
00:04:12,750 --> 00:04:15,010
of code here after executing this for loop.

71
00:04:15,420 --> 00:04:21,510
And then after executing these lines of code here it's going to actually make the spot in between results

72
00:04:21,600 --> 00:04:25,730
invisible so that the user can not interact with that button anymore.

73
00:04:26,040 --> 00:04:28,540
So let's actually run our project and see what happens.

74
00:04:28,650 --> 00:04:34,170
So as you can see here our application is actually running on this emulator on here.

75
00:04:34,280 --> 00:04:37,240
If you actually click on the spot and let's see what happens.

76
00:04:37,290 --> 00:04:41,430
Now we can see the results here and now that button is gone.

77
00:04:41,430 --> 00:04:41,880
OK.

78
00:04:41,910 --> 00:04:49,510
So as you can see here now that button is when is invisible and I cannot interact with that button anymore.

79
00:04:49,800 --> 00:04:51,350
So these are the results here.

80
00:04:51,510 --> 00:04:56,260
And as you can see we've got four students with Fife's with five star review.

81
00:04:56,280 --> 00:04:59,520
We've got two students with our four star review.

82
00:04:59,520 --> 00:05:01,580
We've got four students with us.

83
00:05:01,590 --> 00:05:06,980
We started freestylers review and we've got three students with two stars review.

84
00:05:07,200 --> 00:05:09,580
And here we've got one student with one star review.

85
00:05:09,580 --> 00:05:10,080
OK.

86
00:05:10,350 --> 00:05:14,140
As you can see these are the values that are actually inside of this array.

87
00:05:14,310 --> 00:05:16,320
And here I am actually reading.

88
00:05:16,410 --> 00:05:24,390
Those are values here as you can see and out putting those values onto the screen here so hopefully

89
00:05:24,390 --> 00:05:25,660
that makes sense.

90
00:05:25,890 --> 00:05:28,620
And there is another solution to this problem too.

91
00:05:28,920 --> 00:05:34,440
So let's actually go back and say this main activity dodgeball fight here and let's actually comment

92
00:05:34,440 --> 00:05:42,240
out this line of code here and here inside of this main activity class is actually create a boolean

93
00:05:42,950 --> 00:05:43,800
variable.

94
00:05:43,970 --> 00:05:47,140
Bullion and the name of this variable is first time.

95
00:05:47,340 --> 00:05:49,570
And then let's actually assign the value.

96
00:05:49,610 --> 00:05:50,420
True.

97
00:05:50,700 --> 00:05:51,350
This right here.

98
00:05:51,350 --> 00:05:52,250
Well OK.

99
00:05:52,650 --> 00:05:58,470
And inside of these are set on calculus and are here as you can see inside of this method as you can

100
00:05:58,470 --> 00:06:00,440
see inside of this ugly Smurfette.

101
00:06:00,470 --> 00:06:03,980
Now I can just create an if statement here.

102
00:06:03,990 --> 00:06:08,630
OK enough first time.

103
00:06:09,270 --> 00:06:09,720
OK.

104
00:06:09,780 --> 00:06:17,130
If the value of this first time value is true OK then we can actually put these lines of code here.

105
00:06:17,130 --> 00:06:23,460
These are for loop inside of these first time OK.

106
00:06:23,720 --> 00:06:30,080
And here after this for loop after the end in curly brace of this for loop here I can actually assign

107
00:06:30,980 --> 00:06:37,760
the value false to this first thing but first time assignment operator false.

108
00:06:38,510 --> 00:06:39,450
OK.

109
00:06:39,710 --> 00:06:43,970
So now it's actually on our project and let's see what happens.

110
00:06:43,970 --> 00:06:49,330
So as you can see here now our application is actually run in an emulator.

111
00:06:49,640 --> 00:06:54,040
And here if you actually click on this show me the result spot and let's see what happens.

112
00:06:54,560 --> 00:06:57,040
As you can see now we can see the results here.

113
00:06:57,110 --> 00:06:57,610
OK.

114
00:06:57,770 --> 00:07:04,270
So let's actually click on this button again as you can see these values actually don't change here.

115
00:07:04,310 --> 00:07:04,780
OK.

116
00:07:04,880 --> 00:07:11,630
If I click on this button here now you can see these values are actually don't change and our codes

117
00:07:11,690 --> 00:07:12,990
are actually working right.

118
00:07:13,040 --> 00:07:13,610
OK.

119
00:07:13,700 --> 00:07:19,110
So here we actually created a boolean variable first time and I assigned the value true to this value.

120
00:07:19,560 --> 00:07:25,910
And inside of this Meffert I said that if first time valuable is true if the value of these first time

121
00:07:25,910 --> 00:07:29,240
is true then execs used these lines of code.

122
00:07:29,230 --> 00:07:30,320
Here it is for loop.

123
00:07:30,460 --> 00:07:35,060
So the first thing that we actually click on that button on this.

124
00:07:35,060 --> 00:07:36,300
Show me the results button.

125
00:07:36,470 --> 00:07:39,090
The value of these first time valuable is true.

126
00:07:39,110 --> 00:07:39,790
OK.

127
00:07:40,130 --> 00:07:45,770
So then it's going actually execute this for a loop and then it's going to actually increment the values

128
00:07:45,860 --> 00:07:48,470
of the values of these variables.

129
00:07:48,470 --> 00:07:54,130
For example this five story finally starts really valuable according to the value that is actually inside

130
00:07:54,140 --> 00:07:57,650
of the index of that student reviews array.

131
00:07:57,860 --> 00:08:04,070
And then after executing this for loop after the ending are curly brace of this for loop we set that

132
00:08:04,070 --> 00:08:07,150
first time assignment operator for us.

133
00:08:07,190 --> 00:08:10,300
So the value of this first time variable is now false.

134
00:08:10,410 --> 00:08:16,250
So and then we can actually execute these lines of code and then it reaches the end in calibrates of

135
00:08:16,250 --> 00:08:17,600
this method.

136
00:08:17,780 --> 00:08:22,850
And it going to actually output those values to the screen as you can see these are the values.

137
00:08:22,850 --> 00:08:23,510
OK.

138
00:08:23,930 --> 00:08:30,280
So now the second time that the user clicks on this button as you can see here now again it's going

139
00:08:30,280 --> 00:08:33,040
to actually go inside of this method.

140
00:08:33,200 --> 00:08:37,900
And again it's going to check this condition if first time value bet is true.

141
00:08:38,210 --> 00:08:41,420
So as you can see here we assign the value falls to this valuable.

142
00:08:41,450 --> 00:08:47,810
So now when we when we actually click on this button the value of this first thing valuable is false.

143
00:08:47,810 --> 00:08:54,650
So it's not going to actually execute this if statement here and it is going to only execute like these

144
00:08:54,650 --> 00:08:55,460
lines of code here.

145
00:08:55,460 --> 00:08:56,180
OK.

146
00:08:56,570 --> 00:09:01,950
As you can see here we could even actually put these lines of code inside of this if statements.

147
00:09:01,960 --> 00:09:04,000
So let's actually delete this.

148
00:09:04,410 --> 00:09:09,480
And in calibrates of this if statement as you can see here and we could actually put it here.

149
00:09:09,500 --> 00:09:11,610
After these lines of code here.

150
00:09:12,250 --> 00:09:15,290
And let's actually do our project again and see what happens.

151
00:09:15,290 --> 00:09:20,290
So as you can see here now our application is actually running on this emulator.

152
00:09:20,300 --> 00:09:24,210
So let's actually click on the spot in here and let's see what happens.

153
00:09:24,350 --> 00:09:26,470
As you can see now these values are here.

154
00:09:26,690 --> 00:09:28,760
And let's actually click on this button again.

155
00:09:29,180 --> 00:09:31,770
Now as you can see these values don't change any more.

156
00:09:31,820 --> 00:09:32,720
OK.

157
00:09:33,140 --> 00:09:35,230
So hopefully that makes sense.

158
00:09:35,390 --> 00:09:38,220
And there is another solution to this problem.

