1
00:00:00,450 --> 00:00:03,010
So now I want to create a listener.

2
00:00:03,030 --> 00:00:03,350
OK.

3
00:00:03,360 --> 00:00:09,480
And add value event listener for the computer the unique ID so that Vendi actually data.

4
00:00:09,510 --> 00:00:13,390
For example computer name or computer speed or computer screen.

5
00:00:13,410 --> 00:00:15,870
When are those data actually change.

6
00:00:15,870 --> 00:00:17,230
We can be notified.

7
00:00:17,250 --> 00:00:17,670
Right.

8
00:00:17,850 --> 00:00:20,310
So now I can say database reference.

9
00:00:20,310 --> 00:00:26,190
So you already know that this database reference is actually referring to a category in the database

10
00:00:26,220 --> 00:00:28,480
called computers.

11
00:00:28,530 --> 00:00:29,220
Right.

12
00:00:29,220 --> 00:00:32,600
And here I can say database start to hide.

13
00:00:32,610 --> 00:00:38,330
So here I am referring to the height of this reference and the child is going to be unique.

14
00:00:38,460 --> 00:00:40,980
Computer I.T. right.

15
00:00:41,040 --> 00:00:45,590
And here I can say that add value event listener.

16
00:00:45,690 --> 00:00:52,470
So as you can see here I am calling this method on the height of this database reference and that the

17
00:00:52,470 --> 00:00:54,800
name of that height is unique computer ID.

18
00:00:54,990 --> 00:00:57,720
So here let me actually create a new line right.

19
00:00:57,810 --> 00:00:59,900
That adds value the event listener.

20
00:01:00,000 --> 00:01:02,380
And inside the prentices I can see new.

21
00:01:02,610 --> 00:01:07,200
And here I just need to hold the shift key on my keyboard and then place and delay the real key on my

22
00:01:07,200 --> 00:01:07,930
keyboard.

23
00:01:07,960 --> 00:01:11,470
And now as you can see here this is the first option that appears here.

24
00:01:11,490 --> 00:01:17,520
So I just need to select it and in person it'll be on your keyboard at the end of this Prentice's as

25
00:01:17,520 --> 00:01:18,120
you can see here.

26
00:01:18,150 --> 00:01:24,390
After the end Prentice's here we need to actually put a semicolon here and now we have these two methods

27
00:01:24,620 --> 00:01:27,680
the data changed and on canceled Meffert.

28
00:01:27,840 --> 00:01:30,800
So let's go inside the update or change it here.

29
00:01:31,020 --> 00:01:37,470
And now I'm going to pasting some lines of code here and then I'm going to explain to you what's going

30
00:01:37,470 --> 00:01:38,670
on here.

31
00:01:38,700 --> 00:01:45,140
So as you can see here these are the lines of code that I pasted here in line number two hundred and

32
00:01:45,230 --> 00:01:46,920
76 as you can see here.

33
00:01:47,040 --> 00:01:52,710
We have actually a value bet right and the name of this variable is computer and the data type of this

34
00:01:52,710 --> 00:01:56,190
variable is of type computer class as you can see here.

35
00:01:56,490 --> 00:02:02,520
And then I put an assignment operator here and here I am referring to the name of this argument data

36
00:02:02,590 --> 00:02:07,870
snapshot right data snapshot that gets value.

37
00:02:08,100 --> 00:02:16,080
So here let me tell you that we are actually creating an add value event listener for this unique computer

38
00:02:16,140 --> 00:02:19,940
ID so this unique computer idea is actually a category right.

39
00:02:19,950 --> 00:02:27,030
So when we create our listener and this category we are going to be notified when the children of this

40
00:02:27,030 --> 00:02:29,340
category actually change.

41
00:02:29,340 --> 00:02:30,020
Right.

42
00:02:30,120 --> 00:02:34,490
So now I can see data or snapshot that gets value.

43
00:02:34,590 --> 00:02:40,800
So here I can actually get the value get the object that is inside of this category unique computer

44
00:02:40,800 --> 00:02:41,540
ID.

45
00:02:41,640 --> 00:02:47,570
So because we all of the past we already actually sent a computer object to the server.

46
00:02:47,580 --> 00:02:51,670
Now we want to get those data we want to actually get that object right.

47
00:02:51,810 --> 00:02:57,300
So if we actually scroll to the top here and let's go inside the produce in your computer here as you

48
00:02:57,300 --> 00:03:01,850
can see this is this McFedries produce in your computer and put it in the database.

49
00:03:01,860 --> 00:03:07,650
If you look at this line of code here in line number 162 we are creating a new computer object.

50
00:03:07,650 --> 00:03:08,290
Right.

51
00:03:08,340 --> 00:03:11,830
And here we are actually sending these objects to the server.

52
00:03:11,940 --> 00:03:12,320
Right.

53
00:03:12,330 --> 00:03:15,050
This is actually the computer object that you're sending to the server.

54
00:03:15,270 --> 00:03:20,460
But here inside this method let's go inside this computer change listener.

55
00:03:20,550 --> 00:03:24,340
We want to actually get that object that we already sent to the server.

56
00:03:24,360 --> 00:03:24,950
Right.

57
00:03:24,960 --> 00:03:32,040
So first of all we need to actually create a listener for this unique computer ID and then we can be

58
00:03:32,040 --> 00:03:36,480
notified about the changes of those that are inside that category.

59
00:03:36,480 --> 00:03:36,740
Right.

60
00:03:36,750 --> 00:03:43,020
This unique computer I.D. and here when we say Computer computer as you can see here assignment operator

61
00:03:43,410 --> 00:03:49,810
data snapshot here as you can see this data snapshot argument actually has that object right.

62
00:03:49,830 --> 00:03:54,920
We can actually get that object from this data snapshot here so data snapshot that gets value.

63
00:03:54,920 --> 00:03:56,850
Computer class this time.

64
00:03:56,850 --> 00:03:57,250
Right.

65
00:03:57,330 --> 00:04:01,420
So because the data type is actually a computer class.

66
00:04:01,740 --> 00:04:04,960
And now we already have this computer object.

67
00:04:05,130 --> 00:04:12,630
But if any errors occur and this computer object is actually null then we are going to return from this

68
00:04:12,680 --> 00:04:15,830
if it will not going to actually execute the Smurfette here anymore.

69
00:04:15,990 --> 00:04:21,000
It's going to actually just break out of this if it is not going to execute the lines of code after

70
00:04:21,000 --> 00:04:28,440
this if statement if the computer object is actually not so after this if statement I'm going to execute

71
00:04:28,760 --> 00:04:33,990
I'm going actually pasted some lines of code here and then I'm going to explain to you what's going

72
00:04:33,990 --> 00:04:35,110
on here.

73
00:04:35,130 --> 00:04:40,070
So as you can see here these are lines of code that I've pasted here.

74
00:04:40,260 --> 00:04:43,700
So as you can see I am referring to these three ex-teammate here.

75
00:04:43,830 --> 00:04:50,550
So this the data here is actually fairly unique to this text view that is inside of these horizontal

76
00:04:50,550 --> 00:04:52,930
scroll view here that we put right.

77
00:04:53,190 --> 00:04:57,990
So this takes the data is actually referring to that takes a view that is inside of that horizontal

78
00:04:57,990 --> 00:04:58,830
scroll view.

79
00:04:59,010 --> 00:05:04,530
So if you actually scroll to the top here let me scroll to the top here as you can see we actually declared

80
00:05:04,800 --> 00:05:11,350
this object here inside this class takes the data in line number 31 and it inside is uncreate Smurfette.

81
00:05:11,430 --> 00:05:16,980
We actually initialized this the x 8 or so to the data and then here we cast that this object 2 and

82
00:05:17,310 --> 00:05:23,530
2 are to take your object find the ID are that ID that makes the computer the top.

83
00:05:23,550 --> 00:05:28,420
So this takes you is going to actually hold the data that you are going to get from the server.

84
00:05:28,500 --> 00:05:29,100
Right.

85
00:05:29,130 --> 00:05:30,460
So let me scroll down here.

86
00:05:30,600 --> 00:05:34,160
So here I am saying that the data that said text.

87
00:05:34,170 --> 00:05:37,960
And as you can see here inside the parenthesis we have these values right.

88
00:05:37,980 --> 00:05:44,660
So first of all I am actually saying that instead of double quotes I am saying the computer name Kallen

89
00:05:45,240 --> 00:05:48,050
I am concatenating disvalue with disvalue.

90
00:05:48,100 --> 00:05:51,190
So plus computer that just computer name.

91
00:05:51,220 --> 00:05:53,740
So here I am referring to this computer object.

92
00:05:53,950 --> 00:05:57,800
And inside this computer class as you can see here we have these ghetto's.

93
00:05:57,820 --> 00:05:58,150
Right.

94
00:05:58,150 --> 00:06:00,970
So you already created these getters inside this class.

95
00:06:00,970 --> 00:06:01,210
Right.

96
00:06:01,210 --> 00:06:07,030
For example Gates Computer Seip you return computer Sibiu or get computer name written a computer name

97
00:06:07,150 --> 00:06:10,420
just computer power little computer power and so on.

98
00:06:10,600 --> 00:06:13,170
So let's go back to our main activity the double fight here.

99
00:06:13,180 --> 00:06:18,670
So here I am saying that computer name call in space plus a computer that gets named.

100
00:06:19,030 --> 00:06:20,840
And then here we have another plus.

101
00:06:20,860 --> 00:06:27,070
So here we are concatenating these values together and here instead of double quotes we have a dash

102
00:06:27,280 --> 00:06:34,320
plus computer power Colan plus computers that get power plus an inside double quotes.

103
00:06:34,320 --> 00:06:42,220
We have actually Attash and yet again plus computer speed Colan plus computer that gets computers speed

104
00:06:42,670 --> 00:06:52,170
plus inside it because we have dash plus computer ram Colan plus computer that gets computer RAM plus.

105
00:06:52,410 --> 00:06:58,960
And instead of double quotes we have another dash and here plus computer screen Colan plus computer

106
00:06:59,010 --> 00:07:07,290
that get that gets computer screen plus dash plus computer keyboard Kallen plus a computer that gets

107
00:07:07,290 --> 00:07:13,710
computer keyboard plus dash plus computers colon plus computer that gets computers Sibiu.

108
00:07:13,830 --> 00:07:15,540
So just put these values here.

109
00:07:15,570 --> 00:07:19,810
And later when we actually do run our application it will make sense right.

110
00:07:19,860 --> 00:07:21,260
So don't vote it here.

111
00:07:21,260 --> 00:07:26,220
If if it if this doesn't make sense because it's it's really simple you already know about this concatenation

112
00:07:26,220 --> 00:07:27,210
in Java.

113
00:07:27,510 --> 00:07:30,470
So you should be familiar with this concept already.

114
00:07:30,480 --> 00:07:33,980
So now let's actually go inside our uncreate Smurfette.

115
00:07:34,110 --> 00:07:41,160
Now as you can see here we are actually going to scroll up here as you can see now now let me show you

116
00:07:41,160 --> 00:07:42,630
the uncreate method here.

117
00:07:43,860 --> 00:07:50,810
So this is our uncreate method right now I am going to go inside the curly braces of this uncreate Meffert.

118
00:07:50,930 --> 00:07:53,150
So let's just scroll down here.

119
00:07:53,600 --> 00:08:01,100
And here we are actually creating a listener for this PTEN send or date or update date button.

120
00:08:01,130 --> 00:08:02,300
As you can see here.

121
00:08:02,420 --> 00:08:08,720
So now we are going to go inside this article each method right inside the unclick method of this listener

122
00:08:09,070 --> 00:08:10,940
and send or update data.

123
00:08:11,240 --> 00:08:15,840
And now after these try catch blocks here.

124
00:08:16,080 --> 00:08:21,950
Now I'm going to pasting some more lines of code here and then I'm going to explain to you what's going

125
00:08:21,950 --> 00:08:23,040
on here.

126
00:08:23,060 --> 00:08:28,000
So as you can see here these are the lines of code that I pasted here.

127
00:08:28,250 --> 00:08:30,840
So here we have actually an if statement right.

128
00:08:31,040 --> 00:08:34,320
And here we are taking that ief text.

129
00:08:34,340 --> 00:08:40,210
So again we are using this text utility class in order to check whether this unique computer ID valuable

130
00:08:40,210 --> 00:08:43,550
which is of type strange is empty or not.

131
00:08:43,550 --> 00:08:44,240
Right.

132
00:08:44,270 --> 00:08:48,010
If takes you to a list that is empty unique computer ID.

133
00:08:48,110 --> 00:08:54,740
This means that if the value of the computer of the really unique computer ID valuable is actually empty

134
00:08:55,160 --> 00:09:00,140
then this expression here evaluates to true and it's going to go inside the curly braces of this if

135
00:09:00,140 --> 00:09:03,450
statement and it's going to execute these lines of code here.

136
00:09:03,470 --> 00:09:09,980
Right but if the value of this unique computer ID is not empty then it's not going to actually execute

137
00:09:09,980 --> 00:09:11,290
this statement.

138
00:09:11,360 --> 00:09:12,730
So it is very important.

139
00:09:13,040 --> 00:09:17,740
So now let's go inside the curly braces of this statement and let's see what's going on here.

140
00:09:17,750 --> 00:09:24,530
So here you are saying that if the value of this unit computer ID value is empty then produce a new

141
00:09:24,530 --> 00:09:27,310
computer and put it in the database.

142
00:09:27,620 --> 00:09:30,950
So this Minford we are we are actually running to the Smurfit right.

143
00:09:30,950 --> 00:09:36,340
So now let's actually go let's scroll down here and let's go inside this method.

144
00:09:36,350 --> 00:09:39,920
As you can see this is RMF it produce in your computer and put it in the database.

145
00:09:39,980 --> 00:09:42,960
The Smurfette accepts some arguments as you can see here.

146
00:09:43,010 --> 00:09:49,310
Computer Name computer power computer speed computer ramp computer screen computer keyboard and computer

147
00:09:49,310 --> 00:09:50,340
CPQ.

148
00:09:50,660 --> 00:09:55,970
And here we have this statement and here we are saying that if the value of this unique computer ID

149
00:09:56,270 --> 00:10:01,970
is actually empty then it's going to execute this line of code here a unique computer ID assignment

150
00:10:02,000 --> 00:10:05,870
operator database of friends that pushed that cheat.

151
00:10:06,130 --> 00:10:08,120
So it's going to actually create.

152
00:10:08,210 --> 00:10:14,450
So if that computer is actually empty it's going to create a unique ID here in the database and it's

153
00:10:14,450 --> 00:10:19,180
going to get that key that I.D. and is going to assign that I.D. to this computer I.D. here.

154
00:10:19,700 --> 00:10:26,330
And then as you can see here we are actually creating on your computer object here by these by using

155
00:10:26,330 --> 00:10:28,250
these arguments as you can see here.

156
00:10:28,490 --> 00:10:32,970
And then here you are actually sent this object to this category.

157
00:10:32,990 --> 00:10:39,020
So database of friends that child Junichi computer ID that sits while your computer object.

158
00:10:39,020 --> 00:10:39,610
Right.

159
00:10:39,890 --> 00:10:42,320
So we are saying that this is actually a category.

160
00:10:42,320 --> 00:10:42,910
Why.

161
00:10:42,920 --> 00:10:46,240
Because we are sending this object with these values.

162
00:10:46,250 --> 00:10:46,520
Right.

163
00:10:46,520 --> 00:10:51,890
For example this computer name here is going to be de-value right.

164
00:10:51,890 --> 00:10:57,860
But inside this computer class you can see that we have these instance variables with these names for

165
00:10:57,860 --> 00:10:58,990
example computer name.

166
00:10:58,990 --> 00:11:04,580
Here is actually the key and the value that we passed to this computer name is going to be the value.

167
00:11:04,580 --> 00:11:09,350
So inside this constructed we can see that you're saying that this that computer name we are saying

168
00:11:09,350 --> 00:11:14,610
to this for example this instance variable assignment operator computer name which is of type string.

169
00:11:14,960 --> 00:11:21,540
So inside this main activity that of it when I say database reference the child your computer ID you

170
00:11:21,570 --> 00:11:23,470
are referring to this idea right.

171
00:11:23,510 --> 00:11:29,630
But then I say set value computed object is going to actually pretty soon into computer ID as actually

172
00:11:29,630 --> 00:11:32,220
our category and its scanner.

173
00:11:32,280 --> 00:11:38,030
I actually put the value at the keys and the values of this object inside that category.

174
00:11:38,030 --> 00:11:43,480
So then I when we don't add you to our project you will see how this works.

175
00:11:43,520 --> 00:11:47,950
And finally we are calling the Smurfette change the text of send or update button.

176
00:11:47,960 --> 00:11:52,190
According to the situation so that is going to actually change that the text of the pattern when you

177
00:11:52,250 --> 00:11:57,350
for example want to send the data to the database or when we want to update the data.

178
00:11:57,380 --> 00:12:00,710
So let's go back to our uncle each method here.

179
00:12:00,860 --> 00:12:03,640
So produce in your computer and put it in the database.

180
00:12:03,650 --> 00:12:07,120
So the Smif it actually needs some arguments right.

181
00:12:07,130 --> 00:12:09,850
We need to pass some values to dismiss it.

182
00:12:09,860 --> 00:12:14,230
So for the first argument we need to specify the computer name as you can see here.

183
00:12:14,310 --> 00:12:18,160
Put look at this Smurfette produced in your computer and put it in a database.

184
00:12:18,170 --> 00:12:20,300
The first argument is actually the computer name.

185
00:12:20,450 --> 00:12:21,800
And this is of tape strength.

186
00:12:21,980 --> 00:12:24,300
So we need to pass a string value.

187
00:12:24,380 --> 00:12:28,880
So we already got this string value from our edited text.

188
00:12:28,910 --> 00:12:30,680
As you can see here let me scroll to the top here.

189
00:12:30,680 --> 00:12:34,110
Inside is Uncle Comerford in line number 96.

190
00:12:34,130 --> 00:12:36,630
We created this variable which is of type string.

191
00:12:36,890 --> 00:12:41,930
And we got the text of this EDT computer name as you can see here let me show you the emulator.

192
00:12:42,080 --> 00:12:46,840
We got the text this EDT computer name and we converted this value to a string value.

193
00:12:46,940 --> 00:12:52,010
And here we are assigning that convert value which is now a string value to this computer name.

194
00:12:52,070 --> 00:12:52,520
Right.

195
00:12:52,610 --> 00:12:57,770
So the champ has this computer name to dismiss it as you can see here produce in your computer and put

196
00:12:57,770 --> 00:13:01,440
it in a database computer name for the second argument.

197
00:13:01,490 --> 00:13:06,170
This looks at this method you produce in your computer here for the second argument we need actually

198
00:13:06,290 --> 00:13:09,800
an integer value which is like computer power.

199
00:13:09,800 --> 00:13:14,900
So now the value that we get from this editor is actually a string value.

200
00:13:14,900 --> 00:13:15,380
Right.

201
00:13:15,410 --> 00:13:19,350
So here that's why we created this try catch block here.

202
00:13:19,400 --> 00:13:24,770
As you can see these structures like in say the trickiest block we are converting that string value

203
00:13:24,800 --> 00:13:29,960
computer power to an integer value and we are assigning that integer value to these computer power integer

204
00:13:29,960 --> 00:13:30,450
value.

205
00:13:30,650 --> 00:13:36,370
And if any errors occur here in this line of code here it's going to actually catch that error here.

206
00:13:36,410 --> 00:13:37,400
Right.

207
00:13:37,400 --> 00:13:39,250
So now let me scroll down here.

208
00:13:39,440 --> 00:13:45,220
And as you can see here for the second argument we are passing this value a computer power integer value.

209
00:13:45,530 --> 00:13:49,610
And as you can see here for the first value we need to pass the computer's speed.

210
00:13:49,610 --> 00:13:53,330
So again we passed the computer's speed integer value right.

211
00:13:53,570 --> 00:13:56,600
For the first argument to be passed computerdom integer value.

212
00:13:56,600 --> 00:14:01,920
So if you scroll to the top here as you can see here we have this try catch blocks for the computer

213
00:14:01,930 --> 00:14:06,640
speed integer value and we have these structures applied for the computer integer value.

214
00:14:06,680 --> 00:14:08,440
We created these variables here.

215
00:14:08,510 --> 00:14:09,390
Right.

216
00:14:09,410 --> 00:14:15,590
But because we need integer values here we actually got these string values here and we actually converted

217
00:14:15,590 --> 00:14:21,350
them to an integer value so that we can use it so that we can use them on the Smurfette produce in your

218
00:14:21,350 --> 00:14:25,710
computer and put it in a database for the for this argument computer screen.

219
00:14:25,730 --> 00:14:29,550
So as you can see if you scroll to the top here we actually created this value.

220
00:14:29,570 --> 00:14:35,450
But here can computer screen it it's a computer screen that takes that restraint as you can see a computer

221
00:14:35,450 --> 00:14:36,600
screen here.

222
00:14:36,830 --> 00:14:39,620
And we have computer keyboard and computer Seip you.

223
00:14:39,670 --> 00:14:45,190
So if you pass these values to the Smurfette computer the screen computer keyboard and computer c.p.

224
00:14:45,410 --> 00:14:52,070
And after we actually created a new computer here we are going to actually set the text of these as

225
00:14:52,100 --> 00:14:53,490
it takes to an entire value.

226
00:14:53,510 --> 00:14:54,120
OK.

227
00:14:54,290 --> 00:14:58,280
We're going to actually just it is a computer that said text empty string value.

228
00:14:58,550 --> 00:15:01,870
ADT computer power that said text anti-stalking value.

229
00:15:02,060 --> 00:15:02,840
We don't want to.

230
00:15:02,840 --> 00:15:05,570
Actually we don't want those values to be here.

231
00:15:05,930 --> 00:15:07,820
Haven't we sent those data to the server.

232
00:15:07,820 --> 00:15:08,300
OK.

233
00:15:08,510 --> 00:15:11,900
We just want to empty it and hit the text.

234
00:15:11,900 --> 00:15:15,200
So it is the computer spit that said text empty string value.

235
00:15:15,200 --> 00:15:21,160
It is the computer ram that said text empty value and it's a computer screen that takes the interesting

236
00:15:21,170 --> 00:15:21,910
value.

237
00:15:21,950 --> 00:15:25,120
It's a computer keyboard that set this empty string value.

238
00:15:25,160 --> 00:15:29,140
And finally it is the computer s.p that takes the empty string value.

239
00:15:29,150 --> 00:15:36,380
So now after the end in curly brace of this if statement here I'm going to actually paste in an else

240
00:15:36,380 --> 00:15:37,420
statement here.

241
00:15:37,430 --> 00:15:41,860
So now let me paste it and then I'm going to explain to you what's going on here.

242
00:15:41,870 --> 00:15:46,850
So as you can see here these are the lines of code that I pasted here.

243
00:15:47,000 --> 00:15:50,270
We have this ELSE block here this statement.

244
00:15:50,270 --> 00:15:55,250
So now let's go inside the curly braces of this L statement and let's see what's going on here.

245
00:15:55,400 --> 00:15:58,610
But before that if you look at this statement.

246
00:15:58,610 --> 00:16:03,180
Here we are saying that if takes you that is empty Junichi computer I-T.

247
00:16:03,230 --> 00:16:10,370
This means that if this valuable unique computer ID which is of type strange is actually empty right

248
00:16:10,670 --> 00:16:15,110
then it's going to actually go inside the curly braces of this statement and it's going to execute these

249
00:16:15,110 --> 00:16:16,310
lines of code here.

250
00:16:16,610 --> 00:16:23,660
But if this unique computer ID is not empty then it's going to actually look at this Else statement

251
00:16:23,660 --> 00:16:26,850
here and it's going to execute this Else statement.

252
00:16:26,870 --> 00:16:27,410
Right.

253
00:16:27,410 --> 00:16:29,020
So let's look at these lines of code here.

254
00:16:29,030 --> 00:16:39,530
Inside this statement here if the computer is not empty we want to update the actually the data that

255
00:16:39,530 --> 00:16:40,660
we already created.

256
00:16:40,670 --> 00:16:45,960
You want to update the computer object that we created and sent it to the server.

257
00:16:46,130 --> 00:16:50,450
So now we want to update it modify the produced computer.

258
00:16:50,570 --> 00:16:54,080
So now let me actually show you this method.

259
00:16:54,110 --> 00:16:55,600
Now let me scroll down here.

260
00:16:55,610 --> 00:16:58,120
So now you can see this method here.

261
00:16:58,340 --> 00:17:03,620
Private Voyt modified the prettiest computer and now as you can see here we have these arguments for

262
00:17:03,620 --> 00:17:04,500
this method.

263
00:17:04,610 --> 00:17:08,690
And here you can see that inside the Smurfette We are checking that with all of these arguments are

264
00:17:08,780 --> 00:17:09,840
empty or not.

265
00:17:09,950 --> 00:17:15,960
If these arguments are actually empty then it's not going to actually execute these lines of code here.

266
00:17:15,980 --> 00:17:21,490
For example if this computer name is empty then it's not going to execute this statement right.

267
00:17:21,530 --> 00:17:26,870
But if these computer names for example when the user passes a value to this method and when the user

268
00:17:26,870 --> 00:17:29,570
wants to update the computer name right.

269
00:17:29,660 --> 00:17:33,190
If that value is empty it's not going to execute this statement.

270
00:17:33,260 --> 00:17:38,210
But if that value is not empty and it is actually a real string value then it's going to actually update

271
00:17:38,270 --> 00:17:41,210
that string value according to that cheat.

272
00:17:41,240 --> 00:17:42,840
So let's look at this Meffert here.

273
00:17:43,310 --> 00:17:49,610
So let's go here inside these are unclear methods or else modified to produce computer computer name

274
00:17:49,610 --> 00:17:55,490
computer power computer speed computer and computer screen computer keyboard and computer speed.

275
00:17:55,640 --> 00:18:02,240
So not is that we didn't actually pass integer values to the Smurfit because this Smurfette this scroll

276
00:18:02,240 --> 00:18:04,280
down here we call this method here.

277
00:18:04,310 --> 00:18:07,240
All the arguments of this method are of types think.

278
00:18:07,250 --> 00:18:07,640
Right.

279
00:18:07,700 --> 00:18:13,580
Because there is that I actually chose to use string arguments here is that because text utils cannot

280
00:18:13,580 --> 00:18:15,900
be used on integer values.

281
00:18:16,040 --> 00:18:16,490
Right.

282
00:18:16,520 --> 00:18:18,620
It can only be used on this string by the user.

283
00:18:18,680 --> 00:18:19,160
Right.

284
00:18:19,340 --> 00:18:24,320
And that's the reason I actually chose these arguments to be of type string.

285
00:18:24,500 --> 00:18:29,570
And then we could use these takes you to use here for example for this computer power here as you can

286
00:18:29,570 --> 00:18:33,190
see we used this computer power string value.

287
00:18:33,260 --> 00:18:39,550
But inside this statement you can see that I actually use the try catch block here and it is trouble.

288
00:18:39,710 --> 00:18:40,420
As you can see here.

289
00:18:40,430 --> 00:18:45,740
I converted this computer power argument which is of type string to an integer value and we actually

290
00:18:45,740 --> 00:18:49,080
assigned to that initial value to these computer power integer value.

291
00:18:49,130 --> 00:18:55,880
And here we are actually sending this data to the surburban we are when we want to actually update the

292
00:18:56,030 --> 00:18:57,280
data in the server.

293
00:18:57,320 --> 00:19:01,370
We are actually passing this computer power into value right.

294
00:19:01,730 --> 00:19:04,150
So now let's scroll top to the top here.

295
00:19:04,160 --> 00:19:06,400
As you can see here look at this statement.

296
00:19:06,410 --> 00:19:11,590
So here we want to update the data modify the previous computer computer name computer power.

297
00:19:11,720 --> 00:19:16,140
And if any of these arguments as you can see here is actually empty.

298
00:19:16,150 --> 00:19:22,250
So if you look at this little scroll top to the top as you can see inside these Mefford For example

299
00:19:22,250 --> 00:19:23,430
look at this line of code here.

300
00:19:23,550 --> 00:19:25,900
In computer name assignment operator.

301
00:19:25,940 --> 00:19:32,320
So here we want to get the string value from this computer name right and look at this value here.

302
00:19:32,340 --> 00:19:34,210
We are actually saying that is 3D.

303
00:19:34,220 --> 00:19:38,630
So it's going to convert this value to I think value and it's going to assign this value to this computer

304
00:19:38,630 --> 00:19:39,020
name.

305
00:19:39,170 --> 00:19:43,110
So are getting these values here as a string values as you can see here.

306
00:19:43,280 --> 00:19:48,440
And here we are passing these values to the Smurfette locate this method modified the previous computer.

307
00:19:48,440 --> 00:19:52,180
So this method only needs to the arguments of types 3.

308
00:19:52,220 --> 00:19:58,340
So we directly pass these values to this Mefford computer name computer power computer speed computer

309
00:19:58,360 --> 00:20:01,630
and computer screen computer keyboard and computer CPQ.

310
00:20:01,790 --> 00:20:08,420
And if any of these values for example if the user passes Nuffield here if they use enters nothing here

311
00:20:08,750 --> 00:20:12,760
then it's not going to actually update the computer name right.

312
00:20:12,800 --> 00:20:16,820
So you can actually see that here and now.

313
00:20:17,360 --> 00:20:21,250
Let's after the ending Apprentice's of this listener here.

314
00:20:21,250 --> 00:20:21,480
Right.

315
00:20:21,490 --> 00:20:26,350
So as you can see here we created a lesson there for this button and send all of the data.

316
00:20:26,390 --> 00:20:30,090
So now as you can see here let me show you the highlighted here.

317
00:20:30,200 --> 00:20:35,670
So after the 18 practices of this method again I am actually inside of these uncreate method.

318
00:20:35,690 --> 00:20:43,460
Let's actually go inside these create method and now first let me tell you that for the first time that

319
00:20:43,550 --> 00:20:49,720
our application runs I want the text of this button to change.

320
00:20:49,810 --> 00:20:52,690
I don't want this send but takes to be here.

321
00:20:52,700 --> 00:20:55,000
So let's actually scroll to the top here.

322
00:20:55,190 --> 00:21:05,630
So now for example after here after this line of code here with and get data from server I can say change

323
00:21:05,840 --> 00:21:08,060
the taste of scent or update button.

324
00:21:08,060 --> 00:21:09,220
According to the situation.

325
00:21:09,230 --> 00:21:14,240
So it's going to change the text of the spot and according to this situation and it's going to actually

326
00:21:14,240 --> 00:21:17,060
for example let me ask you to hold the comments on my keyboard.

327
00:21:17,240 --> 00:21:21,650
And if you are using a Windows machine you can hold the control here on your keyboard and then click

328
00:21:21,650 --> 00:21:23,090
on this method here.

329
00:21:23,090 --> 00:21:27,300
So as you can see here now you can see the declaration of the Smurfette and in say this mirror.

330
00:21:27,300 --> 00:21:33,080
Here we are saying that if the value of this unique computer ID is actually empty if this valuable is

331
00:21:33,080 --> 00:21:37,640
actually empty then it's going to execute this line of code here and it's going to set the text produced

332
00:21:37,730 --> 00:21:40,000
in your computer and send it to the server.

333
00:21:40,010 --> 00:21:44,660
So for the first time that you and I tried it on our application is going to actually execute this line

334
00:21:44,660 --> 00:21:45,300
of what year.

335
00:21:45,470 --> 00:21:51,080
But when we actually send the data to the server this computer ID is not going to be empty because in

336
00:21:51,080 --> 00:21:54,810
that case this variable has a unique computer ID.

337
00:21:54,920 --> 00:21:55,400
Right.

338
00:21:55,400 --> 00:21:59,820
Look at this Meffert here produce in your computer and put it in the database.

339
00:21:59,820 --> 00:22:01,070
Here we are checking that.

340
00:22:01,100 --> 00:22:03,060
That is rowdier bill is empty or not.

341
00:22:03,170 --> 00:22:06,790
If it is empty it's going to create a unique computer idea here.

342
00:22:06,800 --> 00:22:07,240
Push.

343
00:22:07,310 --> 00:22:11,410
And it's going to get that key that I.D. and it's going to assign it to the computer I.D..

344
00:22:11,450 --> 00:22:16,230
And when this happens this unique computer idea is not empty anymore.

345
00:22:16,440 --> 00:22:22,880
So that's why you can see that it's going to actually set the face of this button modify that produced

346
00:22:22,880 --> 00:22:24,300
computer data.

347
00:22:24,770 --> 00:22:27,010
So now let me scroll to the top here.

348
00:22:27,020 --> 00:22:33,410
As you can see we call the Smurfette change the text of send or up or update button according to the

349
00:22:33,410 --> 00:22:34,190
situation.

350
00:22:34,280 --> 00:22:34,780
Right.

351
00:22:35,950 --> 00:22:42,110
And we also called the Smurfette in say the produce on your computer Meffert let me scroll down here.

352
00:22:42,280 --> 00:22:45,850
Look at this Meffert produce in your computer and put it in the database as you can see.

353
00:22:45,850 --> 00:22:50,990
We also called this method at the end of this method as you can see here before the ending curly brace

354
00:22:50,990 --> 00:22:55,960
of this method you can see this colleague changed the text of send or update button according to situation

355
00:22:55,960 --> 00:23:01,540
situation because when we create a new object and we pass it to the database and we send it to the database

356
00:23:01,840 --> 00:23:06,880
I want to change the text of the button to update to modify the produced computer.

357
00:23:06,880 --> 00:23:07,700
Right.

358
00:23:07,960 --> 00:23:11,520
Because in that case the computer unit's computer ID is not empty.

359
00:23:11,530 --> 00:23:14,140
So when we run an app or application it will make sense.

360
00:23:14,140 --> 00:23:16,900
So now again let's actually go inside this uncreate method.

361
00:23:16,900 --> 00:23:19,980
So before the end in curly brace of this uncreate Meffert.

362
00:23:20,050 --> 00:23:25,200
Now I'm going to actually just write some lines of code here.

363
00:23:25,270 --> 00:23:30,410
So now I want to create a listener for the PTEN get data from server.

364
00:23:30,460 --> 00:23:34,020
So now let me show you the emulator as you can see here we have this button right.

365
00:23:34,030 --> 00:23:35,500
Get data from server.

366
00:23:35,680 --> 00:23:40,870
So when I click on the spot and we want to actually get the data that we already sent to the server

367
00:23:41,110 --> 00:23:46,600
and we want to put that data inside it takes you inside the horizontal scroll view so that we can actually

368
00:23:46,600 --> 00:23:49,410
scroll and see the other data.

369
00:23:49,420 --> 00:23:57,730
So here inside this uncreate Smurfette I can say PTEN get data from server that set unclick listener

370
00:23:58,450 --> 00:24:03,130
Nijo view that unclick listener as you can see here.

371
00:24:03,130 --> 00:24:09,670
So Enceladus Anklage method here I can just refer to the name of these dismember that they created here.

372
00:24:09,790 --> 00:24:13,940
Let me show you the Smurfette here as you can see computer 8 or change a listener.

373
00:24:14,050 --> 00:24:19,810
So this method is going to actually look at the data that we have on the server and it's going to actually

374
00:24:20,110 --> 00:24:23,400
just notify us when those data change.

375
00:24:23,550 --> 00:24:23,850
OK.

376
00:24:23,860 --> 00:24:26,790
And then we can also get the data from the server.

377
00:24:26,800 --> 00:24:31,230
So now let's actually scroll to the top here and it's going say this uncreate method.

378
00:24:31,270 --> 00:24:32,580
So it is Uncle Mefford.

379
00:24:32,620 --> 00:24:38,110
I can just say computer data change listener as you can see here.

380
00:24:38,110 --> 00:24:40,220
I just referred to the name of that Meffert.

381
00:24:40,510 --> 00:24:45,070
But what happens if the unique computer ID is actually empty.

382
00:24:45,250 --> 00:24:50,680
And in that case in that moment the user clicks on the spot and get data from server.

383
00:24:50,710 --> 00:24:54,790
So because in that moment we don't have any data in the server to get.

384
00:24:54,790 --> 00:24:59,840
We should actually check for that condition if there are unique computer ID.

385
00:24:59,860 --> 00:25:06,160
As you can see here I created an if statement and here I am saying that if unique computer ID is actually

386
00:25:06,160 --> 00:25:13,270
gnarl right then in that case I don't want this line here to be executed because there is no data in

387
00:25:13,270 --> 00:25:14,920
the server to get.

388
00:25:14,920 --> 00:25:20,920
So if the computer ID is null and this means that the user has not actually created a computer object

389
00:25:20,980 --> 00:25:25,440
and send it to the server in that case I don't want this night here to be executed.

390
00:25:25,540 --> 00:25:27,460
So here I can say return.

391
00:25:27,790 --> 00:25:32,230
Right so it's going to actually turn from the Smif it and it's not going to execute the lines of code.

392
00:25:32,260 --> 00:25:34,340
After this written statement here.

393
00:25:34,420 --> 00:25:35,450
Right.

394
00:25:35,550 --> 00:25:36,610
So now.

