1
00:00:00,300 --> 00:00:07,880
So here first of all let's actually a create a variable which is of types three in here inside our class.

2
00:00:07,890 --> 00:00:12,100
So first let's specify the access modifier which is actually private.

3
00:00:12,360 --> 00:00:18,330
And now I need to specify the Data Type of my variable which is string and the name of my variable is

4
00:00:18,380 --> 00:00:23,980
all it takes the received data semicolon.

5
00:00:24,300 --> 00:00:25,540
Right.

6
00:00:25,680 --> 00:00:32,670
Now as you can see if this variable is going to actually hold the all the value of our Takes view which

7
00:00:32,670 --> 00:00:34,660
is this one takes the received data.

8
00:00:34,890 --> 00:00:39,340
So now let's actually scroll down here and let's go inside this and later change my faith.

9
00:00:39,570 --> 00:00:44,880
Now I'm going to paste some lines of code here and then I'm going to explain to you what's going on

10
00:00:44,880 --> 00:00:45,230
here.

11
00:00:45,240 --> 00:00:46,170
Exactly.

12
00:00:46,170 --> 00:00:47,680
So as you can see here.

13
00:00:47,850 --> 00:00:52,540
So as you can see here these are the lines of code that I pasted here.

14
00:00:52,550 --> 00:00:54,800
Inside this on data change method.

15
00:00:55,110 --> 00:00:57,180
So first of all we have a for loop.

16
00:00:57,180 --> 00:00:57,790
Right.

17
00:00:58,110 --> 00:01:04,570
And here you are actually iterating over the values of this state snapshot.

18
00:01:04,570 --> 00:01:08,430
You're either reading over the children of this data or snapshot.

19
00:01:08,430 --> 00:01:16,160
So first as you can see we are calling this add value event listener and this database reference.

20
00:01:16,230 --> 00:01:20,520
So let's scroll to the top here and let's see this valuable database reference.

21
00:01:20,640 --> 00:01:26,610
What is the value of this reference as you can see we are referring to the database reference right

22
00:01:26,610 --> 00:01:28,160
database that gets reference.

23
00:01:28,170 --> 00:01:32,540
So this means that we're are actually referring to let me try to show you the web browser.

24
00:01:32,670 --> 00:01:38,710
We are actually to this instance to this node right when we call database that gets reference is going

25
00:01:38,770 --> 00:01:40,990
to actually give me this note.

26
00:01:41,250 --> 00:01:45,700
So now we provided some children for this note.

27
00:01:45,750 --> 00:01:50,700
As you can see here this one is the highlight of this note and this one as you can see is actually the

28
00:01:50,820 --> 00:01:52,130
height of this note.

29
00:01:52,140 --> 00:01:53,920
This one is the height of this note.

30
00:01:53,940 --> 00:01:57,590
And this one is also the child of this note.

31
00:01:57,600 --> 00:02:00,090
So here we are referring to this note.

32
00:02:00,150 --> 00:02:00,650
Right.

33
00:02:00,780 --> 00:02:04,680
And you are assigning that reference to this database reference variable.

34
00:02:04,950 --> 00:02:06,400
So let me scroll down here.

35
00:02:06,830 --> 00:02:12,830
And here I am actually are either 18 or at the children of this reference data or snapshot.

36
00:02:12,900 --> 00:02:19,560
So when I say database reference that value even listener I am actually creating a listener for this

37
00:02:19,620 --> 00:02:20,220
note.

38
00:02:20,310 --> 00:02:27,820
So what ever whatever happens to the children of this note or two did to this not directly.

39
00:02:27,990 --> 00:02:29,330
Are going to be notified.

40
00:02:29,520 --> 00:02:35,850
Right this update or change if it is going to be called what happens to this node or to the children

41
00:02:35,850 --> 00:02:36,730
of this note.

42
00:02:36,960 --> 00:02:37,740
Right.

43
00:02:38,010 --> 00:02:42,030
And now let's get into insights on that or change it.

44
00:02:42,270 --> 00:02:47,410
But we are we want to as you can see we have children right.

45
00:02:47,490 --> 00:02:55,440
This note has children and we actually created this for loop in order to either aid over the children

46
00:02:55,500 --> 00:02:56,630
of that node.

47
00:02:56,910 --> 00:03:01,630
So I say 48 hours snapshot data snapshot Boxer object.

48
00:03:01,650 --> 00:03:07,780
So as you can see here we have actually a valuable right data snapshot box that object.

49
00:03:07,800 --> 00:03:15,360
So as you can see because we are receiving the data up from the server as the value of type data snapshot

50
00:03:15,820 --> 00:03:19,540
we are actually creating a valuable type data status snapshot which.

51
00:03:19,550 --> 00:03:21,320
Its name is box that object.

52
00:03:21,750 --> 00:03:28,530
And we want to iterate over the children of this data or snapshot that we actually receive from the

53
00:03:28,530 --> 00:03:29,780
Smurfette right.

54
00:03:29,880 --> 00:03:31,730
We receive data as a data snapshot.

55
00:03:31,740 --> 00:03:32,260
Right.

56
00:03:32,460 --> 00:03:37,850
So this data snapshot actually holds this note right.

57
00:03:37,890 --> 00:03:44,550
This data snapshot here holds this node and I am actually getting the children of this note.

58
00:03:44,670 --> 00:03:48,780
So in this way we can actually access the children of this note and we can actually either take over

59
00:03:48,780 --> 00:03:56,040
these notes over these children and we can actually access the objects or box that objects as you can

60
00:03:56,040 --> 00:03:56,880
see here.

61
00:03:56,880 --> 00:04:02,980
So each of these IDs actually has Buxar object as you can see here.

62
00:04:03,000 --> 00:04:12,090
So as you can see this for loop here is going to be executed for each boxer object that we have inside

63
00:04:12,180 --> 00:04:14,330
our server.

64
00:04:14,430 --> 00:04:20,990
So as you can see for example this for loop here is going to be executed for each child.

65
00:04:21,000 --> 00:04:23,860
So let me show you the web browser as you can see this is the child.

66
00:04:23,880 --> 00:04:26,420
Right this is one of these tights.

67
00:04:26,430 --> 00:04:27,560
This is an adult child.

68
00:04:27,570 --> 00:04:30,650
This is another child and this is another child.

69
00:04:30,660 --> 00:04:37,350
So for the first time that this is going to be executed the value of this box that object is going to

70
00:04:37,350 --> 00:04:42,840
actually hold this box that object variable is going to actually hold this child.

71
00:04:42,950 --> 00:04:43,280
Right.

72
00:04:43,290 --> 00:04:44,320
This one.

73
00:04:44,820 --> 00:04:50,580
And now let's actually to go inside the curly braces of this for a loop and let's see what's going on

74
00:04:50,580 --> 00:04:51,430
here.

75
00:04:51,450 --> 00:04:54,950
First of all you're actually getting the boxer object.

76
00:04:55,020 --> 00:04:58,470
So you are getting the boxer object from this child.

77
00:04:58,470 --> 00:04:59,060
Right.

78
00:04:59,070 --> 00:05:02,750
So this actually holds this box that object.

79
00:05:02,750 --> 00:05:03,960
Let me show you this again.

80
00:05:04,100 --> 00:05:12,210
This I.D. here actually holds this box object which its name is a it's punch power it's one hundred

81
00:05:12,230 --> 00:05:14,370
and each and it's punch.

82
00:05:14,370 --> 00:05:16,160
Speed is 200.

83
00:05:16,160 --> 00:05:20,240
So now in line number 72 I am getting the box object.

84
00:05:20,240 --> 00:05:26,800
So Boxer Boxer assignment operator and here I am referring to the sparks that object from this fall.

85
00:05:26,830 --> 00:05:32,480
As you can see here inside the apprentice's all told you that this is going to be executed for each

86
00:05:32,570 --> 00:05:36,740
child that we have here inside our server.

87
00:05:36,740 --> 00:05:37,270
Right.

88
00:05:37,310 --> 00:05:40,130
That we have for this note.

89
00:05:40,130 --> 00:05:45,240
So for the first time that this fall here is going to be executed the first child is this one.

90
00:05:45,740 --> 00:05:52,070
And in this way we can actually get the box objects or box it up take that good value boxer that class.

91
00:05:52,070 --> 00:05:53,680
So here are we.

92
00:05:53,730 --> 00:05:56,810
I should change the spots that object child.

93
00:05:57,140 --> 00:06:02,650
Let's actually change this one also to child and in this way it makes more sense.

94
00:06:02,660 --> 00:06:07,370
So here you can see that we're actually either over the children of the state or a snapshot which is

95
00:06:07,370 --> 00:06:08,180
this one.

96
00:06:08,300 --> 00:06:12,360
This is the latest snapshot right because it holds the reference to this note.

97
00:06:12,500 --> 00:06:17,990
So first we are actually getting the box set up to act like creating a variable of type Boxer and its

98
00:06:17,990 --> 00:06:20,200
name is Buxar assignment operator.

99
00:06:20,270 --> 00:06:22,410
And here I am referring to this child.

100
00:06:22,790 --> 00:06:23,290
Right.

101
00:06:23,310 --> 00:06:25,660
That gets value boxes that class.

102
00:06:25,670 --> 00:06:28,730
So this idea here is actually the height of this note.

103
00:06:28,730 --> 00:06:29,290
Right.

104
00:06:29,570 --> 00:06:34,820
And when I say child so I am referring to this ID that gets value.

105
00:06:34,850 --> 00:06:37,850
The value is actually the sparks that object.

106
00:06:38,060 --> 00:06:38,530
Right.

107
00:06:38,540 --> 00:06:41,000
Box it and its type is box at that class.

108
00:06:41,000 --> 00:06:43,210
So we must specify the type.

109
00:06:43,220 --> 00:06:46,170
So inside the prentices I just say boxes that class.

110
00:06:46,610 --> 00:06:49,910
And here we have an if statement.

111
00:06:50,120 --> 00:06:52,820
And here I am saying that if all the received data.

112
00:06:52,820 --> 00:06:57,640
So here I am referring to is sitting valuable that we created here in line number 28.

113
00:06:57,710 --> 00:07:04,430
So so here I am saying that if the value of this variable is actually null then instead of printing

114
00:07:04,510 --> 00:07:10,820
a null instead of actually displaying the value not to the user just that display an empty value swipe

115
00:07:10,940 --> 00:07:11,810
instead of double quotes.

116
00:07:11,800 --> 00:07:15,380
Or just put a space right on MTV.

117
00:07:15,530 --> 00:07:16,750
So all takes the risk.

118
00:07:16,860 --> 00:07:24,140
If the assignment operator an empty string value right and now after this if statements look at these

119
00:07:24,140 --> 00:07:28,530
lines of code here I am saying that TXI received data.

120
00:07:28,550 --> 00:07:34,150
So here I am referring to this text view that that we actually declare here inside our class and to

121
00:07:34,160 --> 00:07:35,090
be initialized.

122
00:07:35,210 --> 00:07:37,980
This takes you here inside our uncreate Smurfette.

123
00:07:38,030 --> 00:07:44,180
So here I am saying that TXU received data that said text old to receive data.

124
00:07:44,210 --> 00:07:49,530
So first I want to actually print the old value of party activity data.

125
00:07:49,530 --> 00:07:57,470
I want to actually display this value first plus And then I am referring to the sponsored object that

126
00:07:58,120 --> 00:08:00,590
gets box surname right.

127
00:08:00,590 --> 00:08:03,800
Buxar that get Buxar name first.

128
00:08:03,820 --> 00:08:10,250
I want to display this value plus an inside double quotes we have a dash plus.

129
00:08:10,520 --> 00:08:19,730
And then I want to print this value box that gets punch power plus dash plus boxer that get punch speed

130
00:08:20,350 --> 00:08:21,210
plus.

131
00:08:21,260 --> 00:08:23,830
And here we have this backward slash.

132
00:08:23,850 --> 00:08:30,640
And so this is going to actually create a new life character after printing the values of our boxer

133
00:08:30,680 --> 00:08:32,020
objects.

134
00:08:32,030 --> 00:08:40,220
And finally as you can see here we are actually assigning the value of RTX the received data here that

135
00:08:40,340 --> 00:08:43,850
takes that whispering to are all ATX to receive data.

136
00:08:44,180 --> 00:08:51,590
So in this way this variable here is going to actually hold the old values of RTX to receive data as

137
00:08:51,590 --> 00:08:52,640
a string value.

138
00:08:53,060 --> 00:08:56,290
And we can actually display all of those values to the user.

139
00:08:56,360 --> 00:09:00,380
So now let me actually run our project and then it will make more sense.

140
00:09:00,380 --> 00:09:06,380
So now as you can see here our application is actually running on this emulator and now you can see

141
00:09:06,380 --> 00:09:09,040
that we received the data from the server.

142
00:09:09,170 --> 00:09:13,710
So the first Buxar is name the name of the first Buxar is a.

143
00:09:14,120 --> 00:09:16,950
And the punch power is 100.

144
00:09:16,970 --> 00:09:20,410
And the punch spit is to hunt that so you can see these values here.

145
00:09:20,420 --> 00:09:26,750
The second box is B 10 20 C 490 and D 4900.

146
00:09:26,750 --> 00:09:31,700
So these are the Buxar objects that we are receiving from the server.

147
00:09:31,850 --> 00:09:41,210
So let's actually create some more Puckster optics so here I can say a b c d e 20 free 12.

148
00:09:42,050 --> 00:09:58,100
And here as you can see we have again these values a 100 dash 20 write the 10 20 C 490 and the 14:19.

149
00:09:58,280 --> 00:10:07,010
So when ever I actually click on the spot in the all the values of our text you are going to be also

150
00:10:07,010 --> 00:10:08,090
displayed.

151
00:10:08,090 --> 00:10:08,470
Right.

152
00:10:08,600 --> 00:10:11,580
And then we have also the new value which is this one.

153
00:10:11,690 --> 00:10:15,320
And if it is a scroll down here you can see this here.

154
00:10:15,860 --> 00:10:21,360
And as you can see it because you actually created a scroll you can actually scroll here.

155
00:10:21,530 --> 00:10:24,200
So let's actually create some more values here.

156
00:10:24,650 --> 00:10:32,310
So here I can say for example a B C D E F and the box a power punch power is for example 90 depan speed

157
00:10:32,360 --> 00:10:33,630
is 2000.

158
00:10:33,950 --> 00:10:40,960
And if I can send data to several here and again you can see that these values are again displayed.

159
00:10:40,980 --> 00:10:46,070
They have a B C D E and F right.

160
00:10:46,130 --> 00:10:48,700
So these values are the old values of art.

161
00:10:48,710 --> 00:10:57,080
It takes a view and we have also the value of the newest object that we actually sent to the server.

162
00:10:57,080 --> 00:10:57,960
So that's why.

163
00:10:57,980 --> 00:11:04,070
Let me introduce you to the Android studio that's actually created this valuable all the exclusive data

164
00:11:04,070 --> 00:11:08,330
in order to hold the the old value of RTX the receive data.

165
00:11:08,330 --> 00:11:17,070
So if I actually create for example someone objects G and if I click on this button for example it may

166
00:11:17,070 --> 00:11:25,100
create some objects which send that observer they send data to a server.

167
00:11:25,150 --> 00:11:29,040
And now as you can see we have all these objects here.

168
00:11:29,050 --> 00:11:29,660
Right.

169
00:11:29,860 --> 00:11:35,620
And we have these objects A B C D E F G H k.

170
00:11:35,740 --> 00:11:43,480
You can see that I actually put these values here and we have also the old values that are actually

171
00:11:43,480 --> 00:11:44,520
printed here.

172
00:11:44,680 --> 00:11:45,280
Right.

173
00:11:45,280 --> 00:11:51,220
So here in this tutorial I wanted to show you that how you can actually either aid over the children

174
00:11:51,340 --> 00:11:52,480
of your note.

175
00:11:52,750 --> 00:11:54,660
So let me show you the web browser.

176
00:11:54,760 --> 00:11:58,480
So here as you can see let me scroll to the top as he has it is our notes right.

177
00:11:58,660 --> 00:12:03,640
And we are referring to this note not a specific child in the previous tutorials.

178
00:12:03,640 --> 00:12:11,020
I actually told you about up just referring to one specific child in order to get the values of that

179
00:12:11,020 --> 00:12:12,100
specific child.

180
00:12:12,250 --> 00:12:18,880
But in this the story or I am showing you obey in order to iterate over the children of your note and

181
00:12:18,880 --> 00:12:25,510
get the values of all these notes right and get the values of all these children.

182
00:12:25,510 --> 00:12:28,450
So now let me show you another important point.

183
00:12:28,480 --> 00:12:30,240
So now let me show you the emulator.

184
00:12:30,370 --> 00:12:35,800
And as you can see here you can see these values here and you can see that the older values are actually

185
00:12:36,130 --> 00:12:38,340
displayed here multiple times.

186
00:12:38,370 --> 00:12:41,400
Maybe you don't want this to happen right.

187
00:12:41,480 --> 00:12:50,170
And here in order to solve this problem before this for loop here I can just refer to the name of this

188
00:12:50,170 --> 00:12:54,610
valuable old Teac the received data assignment operator.

189
00:12:54,790 --> 00:12:58,870
And then I can assign an empty string value to this variable.

190
00:12:59,230 --> 00:13:01,350
So let's run our project.

191
00:13:01,690 --> 00:13:04,510
And now here I'm going to actually explain to you what's going on here.

192
00:13:04,510 --> 00:13:11,380
Exactly let's actually see our application here and now it can actually display these values here that

193
00:13:11,380 --> 00:13:15,410
are going to be received from the server.

194
00:13:15,730 --> 00:13:26,010
So now you can see that we have only this a here b c d e f g h k and we have these are all other values.

195
00:13:26,080 --> 00:13:28,230
Let's actually open our web browser.

196
00:13:28,240 --> 00:13:31,300
Let me create another box and object.

197
00:13:31,300 --> 00:13:37,680
So here for example I can say Buxar a box or a.

198
00:13:37,870 --> 00:13:40,220
And the punch power is for example 5000.

199
00:13:40,240 --> 00:13:42,120
And the punch speed is 5000.

200
00:13:42,130 --> 00:13:42,780
Right.

201
00:13:42,820 --> 00:13:45,490
Let's actually click on the spot and send data server.

202
00:13:45,910 --> 00:13:49,110
And here as you can see we have this object right.

203
00:13:49,240 --> 00:13:55,510
But you can see that the previous values the old values are not printed are not actually displayed here

204
00:13:55,540 --> 00:13:56,160
again.

205
00:13:56,320 --> 00:13:57,140
Right.

206
00:13:57,220 --> 00:14:03,850
So you can see that we have also we have just this value and if we actually print P for example it may

207
00:14:03,850 --> 00:14:05,090
actually disappear.

208
00:14:05,080 --> 00:14:08,120
This virtual keyboard for example box.

209
00:14:08,470 --> 00:14:10,730
And if I click on the spot and send data at the server.

210
00:14:10,750 --> 00:14:13,080
Now you can see this box here.

211
00:14:13,410 --> 00:14:14,040
Right.

212
00:14:14,050 --> 00:14:18,430
Let me actually change this to boxers see if I click on this button.

213
00:14:18,430 --> 00:14:21,030
Now we have only the sponsors see why.

214
00:14:21,040 --> 00:14:22,720
Let me show you the Android studio.

215
00:14:22,900 --> 00:14:29,650
So for example you know that is an update or change if it is going to be called when ever the user changes

216
00:14:30,080 --> 00:14:32,290
the date of an event that they are inside.

217
00:14:32,290 --> 00:14:33,980
Our server is after the change.

218
00:14:34,090 --> 00:14:39,500
So now you can see that first of all we are actually assigning the value zero to this all takes the

219
00:14:39,520 --> 00:14:42,220
received data and we have this for loop here.

220
00:14:42,220 --> 00:14:47,680
So this follow up here is going to be executed for each child that we have inside our notes.

221
00:14:47,680 --> 00:14:52,510
So now let me show you the web browser so you can see that we have this note and these are the children

222
00:14:52,540 --> 00:14:53,270
of this note.

223
00:14:53,320 --> 00:14:53,680
Right.

224
00:14:53,680 --> 00:14:55,570
We have multiple children.

225
00:14:55,570 --> 00:15:01,990
We have lots of children here and now or you can see that we are getting the box that object from these

226
00:15:01,990 --> 00:15:03,810
children as you can see here for example.

227
00:15:03,810 --> 00:15:06,810
This is the first child and this is the box of object.

228
00:15:06,880 --> 00:15:07,700
Right.

229
00:15:07,720 --> 00:15:10,730
And here you are actually creating this if statement.

230
00:15:10,930 --> 00:15:18,020
So I told you about this if statement here and you're actually getting the value of that Buxar right.

231
00:15:18,040 --> 00:15:20,770
For example box name a 100 200.

232
00:15:20,770 --> 00:15:23,640
So now let me show you the emulator.

233
00:15:23,650 --> 00:15:25,210
So this these are the values.

234
00:15:25,420 --> 00:15:27,820
These are the values of 100 200.

235
00:15:27,970 --> 00:15:33,830
And here in this line of code you are assigning the value of these Teac still receive data to this all

236
00:15:33,910 --> 00:15:35,310
the receive data body.

237
00:15:35,340 --> 00:15:43,090
And so in this way after this follow up finishes executing these lines of code we have all these values

238
00:15:43,090 --> 00:15:43,750
here.

239
00:15:43,990 --> 00:15:44,530
Right.

240
00:15:45,340 --> 00:15:51,490
So in this way you can see that we have these values and if we actually create another box that object

241
00:15:51,490 --> 00:15:59,590
for example box of the then in that way again it's going to actually send this data to the server and

242
00:15:59,650 --> 00:16:00,830
we can actually get.

243
00:16:00,910 --> 00:16:06,400
Again it's going to execute this for loop and it's going to actually display these values here.

244
00:16:06,490 --> 00:16:12,330
But you can see that when this data change if it here is going to be executed first it's going to actually

245
00:16:12,430 --> 00:16:17,590
empty the value of this valuable all text receive data and then it's going to actually execute this

246
00:16:17,590 --> 00:16:18,460
for a loop.

247
00:16:18,670 --> 00:16:23,270
And that's why you can see that these values are here and these values are not repeated.

248
00:16:23,500 --> 00:16:29,260
We can only see this here once B C and all the all the other values.

249
00:16:29,440 --> 00:16:33,810
So hopefully that makes sense and I think that's enough for this theater.

250
00:16:33,970 --> 00:16:39,820
So if you have any questions about the concepts that are hard to you in this tutorial please post the

251
00:16:39,820 --> 00:16:43,810
discussion in the course and then I'll do my best to answer all of your questions.

252
00:16:43,810 --> 00:16:46,520
Thank you very much for watching and I'll see you in the next year.

253
00:16:46,530 --> 00:16:46,940
Tanyard.

