1
00:00:00,240 --> 00:00:04,710
Hire one so that it is literally all you're going to go ahead and we're going to go inside these update

2
00:00:04,710 --> 00:00:10,980
martial our activity class and we're going to actually put some logic's here inside this unclear method.

3
00:00:11,280 --> 00:00:17,820
So first of all in order to identify the martial art object that is actually being updated updated or

4
00:00:17,820 --> 00:00:24,120
being modified We need to have the ID of that specific martial art object.

5
00:00:24,120 --> 00:00:27,790
So let me show you this method here and modify user interface method.

6
00:00:27,800 --> 00:00:31,510
Inside is of the activity of the martial activity class.

7
00:00:31,700 --> 00:00:39,300
Here inside this method you can see that when I created the button for each row actually for each object

8
00:00:39,300 --> 00:00:46,440
in order to mollify or updates that button I said that the ID of that button is the same ID of that

9
00:00:46,440 --> 00:00:49,350
martial art object right here.

10
00:00:49,410 --> 00:00:51,010
So let's scroll down here.

11
00:00:51,140 --> 00:00:54,190
You can see this method here Uncle Meffert right.

12
00:00:54,210 --> 00:01:00,840
Look at this argument here view which is of the view this argument is actually the button that is being

13
00:01:00,900 --> 00:01:02,240
interactive.

14
00:01:02,400 --> 00:01:03,540
Right.

15
00:01:03,540 --> 00:01:10,380
So remember that button is a subclass of view and you can see this argument is the use for user interface

16
00:01:10,380 --> 00:01:16,050
components that is being triggered when the user is actually just interacting with that button.

17
00:01:16,050 --> 00:01:18,890
So this view is the same as that button.

18
00:01:18,900 --> 00:01:23,790
So this means that if I get the idea of this view this means that I am actually getting the ID of that

19
00:01:24,060 --> 00:01:26,160
martial art object.

20
00:01:26,160 --> 00:01:28,210
So let's create a variable of that integer.

21
00:01:28,440 --> 00:01:33,710
And here I can say martial arts martial art object.

22
00:01:33,850 --> 00:01:36,380
The assignment operator view.

23
00:01:36,480 --> 00:01:37,940
I am referring to these arguments right.

24
00:01:38,020 --> 00:01:40,820
That gets I-T semi-colon.

25
00:01:40,830 --> 00:01:47,970
So in this way we can access the ID of the Marshal object that is being actually updated that is being

26
00:01:48,720 --> 00:01:49,580
modified.

27
00:01:51,420 --> 00:01:59,610
Now we need to also have access to the value of the edit texts that we have for each marshal or object

28
00:01:59,610 --> 00:02:04,470
so for each martial art object you're going to have an edit text for the name and edit text for the

29
00:02:04,470 --> 00:02:09,750
price of a martial art and another in it a distaste for the color of that martial art.

30
00:02:09,750 --> 00:02:15,930
So here inside this modify user interface Smurfette you can see that when I created these edit text

31
00:02:15,990 --> 00:02:23,690
here you can see that for the ID of each editor you can see that I actually accessed the ID of the monster

32
00:02:23,760 --> 00:02:29,330
object for example for this one and I and I added about your number 10 to that value or I access them

33
00:02:29,400 --> 00:02:36,660
a marshal ID of the of this object here for this second edit takes which is going to be for the price

34
00:02:36,660 --> 00:02:37,480
of the text right.

35
00:02:37,530 --> 00:02:42,200
And I did a de-value number 22 that ID or for example this one.

36
00:02:42,420 --> 00:02:49,980
So now I can easily access or edit texts inside our row so I can't say for example it edit text I can

37
00:02:49,980 --> 00:02:54,330
create a variable of the text and the name of this editor is EDT.

38
00:02:54,630 --> 00:02:56,330
EDT marshal Anthony EDT.

39
00:02:56,790 --> 00:02:57,860
Martial arts.

40
00:02:59,560 --> 00:03:10,580
N assignment operator and I can say first I need to cestus object to an added text object find view

41
00:03:10,580 --> 00:03:16,810
by id and here in order to access the ID of that martial art.

42
00:03:16,820 --> 00:03:18,250
Actually of that it takes.

43
00:03:18,260 --> 00:03:21,210
That is for the name of that martial art.

44
00:03:21,230 --> 00:03:22,680
We have this idea here right.

45
00:03:22,760 --> 00:03:28,390
So I can say martial art object id plus 10 right.

46
00:03:28,490 --> 00:03:34,520
This ID is exactly the same ID that I specified he had in say this modify use an interface method.

47
00:03:34,640 --> 00:03:37,320
When I wanted to specify an ID for this.

48
00:03:37,320 --> 00:03:42,070
Actually for this ID text for the name the text we can see that here in this number zero.

49
00:03:42,470 --> 00:03:46,000
So in order to access the other additives I can actually do the same here.

50
00:03:46,010 --> 00:03:50,960
So he said his uncle Meffert and below this line of quote I can create another rowdier text.

51
00:03:51,260 --> 00:03:52,910
EDT martial arts.

52
00:03:52,910 --> 00:03:55,290
Price is martial art.

53
00:03:55,290 --> 00:04:01,640
Price assignment operator and I can actually cast this object to it takes the object find view by ID

54
00:04:02,090 --> 00:04:08,920
and an inside Apprentice's just type in here marshal not object id plus 20 right semicolon.

55
00:04:09,350 --> 00:04:11,680
Again create another edit text.

56
00:04:12,380 --> 00:04:22,180
So this time marshal EDT martial arts color so EDT martial arts color assignment operator and let's

57
00:04:22,180 --> 00:04:25,170
cast this object to an editing object.

58
00:04:25,180 --> 00:04:27,010
So here let me put it here.

59
00:04:27,460 --> 00:04:28,610
Let's put up her Apprentice's.

60
00:04:28,630 --> 00:04:33,430
It takes fine view of the martial art object already.

61
00:04:33,510 --> 00:04:37,000
Plus first the semicolon.

62
00:04:37,200 --> 00:04:45,270
So now that we have access to these texts I can access the string value of each edit text so I can create

63
00:04:45,270 --> 00:04:54,490
a variable of type string here and I can say marshal that name string Raddy martial arts name streambed

64
00:04:55,270 --> 00:04:57,330
value assignment operator.

65
00:04:57,340 --> 00:05:05,610
I can access this EDT martial art name that get text get text to string semicolon.

66
00:05:05,890 --> 00:05:07,970
Let's create another variable of types.

67
00:05:07,990 --> 00:05:10,830
So it's three and martial art.

68
00:05:11,020 --> 00:05:12,710
Price string value of martial art

69
00:05:15,890 --> 00:05:18,410
price street value

70
00:05:22,050 --> 00:05:30,620
assignment operator and here I can refer to this EDT Marshall Price that it takes the two strange semicolon.

71
00:05:30,960 --> 00:05:38,010
Again let's create another variable of type screen and its name is martial art color string value martial

72
00:05:38,010 --> 00:05:47,980
arts color screen value streambed value assignment operator anything martial art color that get text

73
00:05:48,470 --> 00:05:50,690
that string semicolon.

74
00:05:50,860 --> 00:05:51,650
Right.

75
00:05:51,760 --> 00:05:59,380
So now that we have access to these city values of this editor access now I can't say so I can't refer

76
00:05:59,380 --> 00:06:07,270
to that database handler reference to this instance that modify I can access this method modify Monstro

77
00:06:07,270 --> 00:06:09,390
not object here.

78
00:06:09,400 --> 00:06:14,410
So here we need to pass the id the martial art name the price and the color.

79
00:06:14,440 --> 00:06:19,140
So we have the ID which is going to be off that interior light and the martial art name is of types

80
00:06:19,140 --> 00:06:19,720
screen.

81
00:06:20,050 --> 00:06:24,600
The martial art prices of type double and the martial art colors of types.

82
00:06:24,640 --> 00:06:30,760
So let's first pass the martial art ID so I can say martial object id come on.

83
00:06:30,960 --> 00:06:33,260
I need to pass the martial art name right.

84
00:06:33,340 --> 00:06:34,450
So I can access.

85
00:06:34,450 --> 00:06:39,970
I can have I have access to that much with that name string value so I can say martial art name street

86
00:06:40,000 --> 00:06:41,560
value karma.

87
00:06:41,920 --> 00:06:45,160
So here we need to pass the martial art price.

88
00:06:45,220 --> 00:06:46,250
It is of type string.

89
00:06:46,270 --> 00:06:49,570
But I'm going to solve it in a moment so for not just pass this value.

90
00:06:49,570 --> 00:06:53,600
Martial art actually priced sitting by the comma.

91
00:06:54,010 --> 00:06:58,930
And finally we need to pass the color so much of that color to city value which is again of types doing

92
00:06:58,960 --> 00:07:02,860
martial art color string value right.

93
00:07:02,930 --> 00:07:03,830
But we have an error.

94
00:07:03,830 --> 00:07:07,080
So let me create a new line here so that you can see these values better.

95
00:07:07,130 --> 00:07:08,440
And let me put it here.

96
00:07:08,770 --> 00:07:09,750
And this one here.

97
00:07:09,920 --> 00:07:14,960
So first we pass them onto the object id which is of that integer and it is a teacher.

98
00:07:15,110 --> 00:07:18,320
And then we passed the marshal named value it is OK.

99
00:07:18,620 --> 00:07:21,980
And here we have a problem Marshall Price string value.

100
00:07:22,190 --> 00:07:26,910
We need to somehow convert this thing about to an integer value.

101
00:07:27,140 --> 00:07:32,190
But in order to do that and use it for example may until later.

102
00:07:32,220 --> 00:07:35,950
Ok for example they use an end to the letter A in the edit text.

103
00:07:35,960 --> 00:07:39,170
So in that case our application is going to crash.

104
00:07:39,170 --> 00:07:45,260
We need to have a tri touch block in order to catch the number format exception so that our application

105
00:07:45,290 --> 00:07:51,050
is not going to crash or we can actually do for example in the catch block we can create a Toastmasters

106
00:07:51,380 --> 00:07:56,990
and we can let the use of know that the value that is going to be entered inside that specific edit

107
00:07:56,990 --> 00:08:01,120
text must be actually a numeric value not a string value.

108
00:08:01,310 --> 00:08:02,800
For example a letter.

109
00:08:02,810 --> 00:08:06,930
So now here let's create a to each block.

110
00:08:06,930 --> 00:08:08,150
Here is Troy.

111
00:08:08,570 --> 00:08:13,520
Open and close the strobe light by using the curly braces after the end in curly brace of the Triple

112
00:08:13,520 --> 00:08:14,460
X just a bit here.

113
00:08:14,460 --> 00:08:17,340
Cheche inside the prentices of this church plug.

114
00:08:17,350 --> 00:08:21,830
Here I can specify the type of the exception which is going to be number format.

115
00:08:21,840 --> 00:08:22,880
Exception.

116
00:08:23,030 --> 00:08:28,390
This is the name of this actually the argument and just open and close this test by using curly braces.

117
00:08:28,430 --> 00:08:29,600
Look at this here.

118
00:08:29,600 --> 00:08:32,840
This method calling here databus handler that modify motional object.

119
00:08:32,840 --> 00:08:38,010
Let's cut the Smurfette here and put it here inside this try block.

120
00:08:38,390 --> 00:08:44,900
But first here before calling this method a modified Marshall object on this database handler reference.

121
00:08:45,080 --> 00:08:50,990
First let's create a variable of type double so double and the name of this variable is going to be

122
00:08:51,050 --> 00:08:52,510
martial art.

123
00:08:52,850 --> 00:09:00,740
Art price double value double value assignment operator.

124
00:09:00,840 --> 00:09:07,770
And here I can refer to this double class that parse double that parse double and I just need to pass

125
00:09:07,830 --> 00:09:12,420
a string value to this method and it's going to convert that value to a double value so that we can

126
00:09:12,420 --> 00:09:13,720
assign it to this variable.

127
00:09:13,980 --> 00:09:19,210
So I can pass this martial art a price string value here.

128
00:09:19,320 --> 00:09:21,720
And finally I just need to put a semicolon at the end of my statement.

129
00:09:21,720 --> 00:09:27,900
So let me create a new line here and here instead of passing marshal price string value to the Smurfette

130
00:09:28,230 --> 00:09:30,870
I just need to pass Marshall Price double value.

131
00:09:30,900 --> 00:09:36,030
So I just need to delete this value and I can say Marshall Price WIOD you that's it.

132
00:09:36,030 --> 00:09:37,740
Now we have no errors here.

133
00:09:37,950 --> 00:09:38,780
Right.

134
00:09:38,790 --> 00:09:40,670
So let's run our application.

135
00:09:40,690 --> 00:09:46,830
But but before that let's make sure that we have actually created an intent inside our main activity

136
00:09:46,830 --> 00:09:54,450
class for this update marshal that activity class so let's go to the main activity class here.

137
00:09:55,420 --> 00:10:02,190
So here is an option item selected Meffert you can see that we have a case for tab at Marshal activity

138
00:10:02,200 --> 00:10:04,200
we have a case for the delit marshal activity.

139
00:10:04,210 --> 00:10:06,510
So we need to create another case here.

140
00:10:06,680 --> 00:10:10,150
Inside is an options item selected inside this main activity class.

141
00:10:10,150 --> 00:10:17,320
So here is just say in case our That ID that update just opened here.

142
00:10:17,350 --> 00:10:18,610
Update marshal.

143
00:10:18,790 --> 00:10:20,000
OK Colin.

144
00:10:20,250 --> 00:10:22,300
So this is this update Monserrat item.

145
00:10:22,320 --> 00:10:26,780
If they use that actually presses this item you are going to create a new intent.

146
00:10:26,790 --> 00:10:38,240
Intent and the name of this intent is going to be actually update martial art the intent assignment

147
00:10:38,250 --> 00:10:43,020
operator new intent and I just need to pass the context.

148
00:10:43,040 --> 00:10:49,460
So I activity that this and for and for the second argument 10:22 activity that we're going to transition

149
00:10:49,460 --> 00:10:51,460
to you're going to move to actually.

150
00:10:51,500 --> 00:10:56,890
So the second activity is going to be update martial art activity that class.

151
00:10:56,900 --> 00:11:02,450
So let me put a semicolon at the end of my statement and then let me create a new line here.

152
00:11:03,140 --> 00:11:10,640
So after this line of code I can actually say start activity and I can't say update marshal activity

153
00:11:10,700 --> 00:11:12,380
intent.

154
00:11:12,430 --> 00:11:18,600
Finally I need to return true for this case or return to suddenly column.

155
00:11:18,920 --> 00:11:21,450
So let's learn our application now.

156
00:11:22,630 --> 00:11:25,320
Let's actually select one of these devices here.

157
00:11:25,510 --> 00:11:26,290
For example this one.

158
00:11:26,290 --> 00:11:27,580
And then click on OK.

159
00:11:27,970 --> 00:11:32,110
So here you can see that our application is running on this emulator here.

160
00:11:32,380 --> 00:11:36,440
So let's actually click on these ellipses a button here this dropdown menu.

161
00:11:36,700 --> 00:11:39,360
So here you can see that we have these items.

162
00:11:39,360 --> 00:11:43,130
So let's click on update the martial arts id..

163
00:11:43,150 --> 00:11:45,110
Now we transitioned to this activity.

164
00:11:45,250 --> 00:11:51,960
So you can see that we have the ID of these martial take is now seven the name.

165
00:11:51,970 --> 00:11:53,170
And you can see it there.

166
00:11:53,230 --> 00:11:56,580
Actually the price this is the color here.

167
00:11:56,830 --> 00:12:00,070
And finally we have this button here modified.

168
00:12:00,370 --> 00:12:01,230
Right.

169
00:12:01,390 --> 00:12:02,100
So.

170
00:12:02,440 --> 00:12:07,580
So you can see that we cannot actually see the entire text of the spot in here.

171
00:12:07,600 --> 00:12:11,990
This button doesn't have enough space to be seen actually on the screen here.

172
00:12:12,160 --> 00:12:16,220
So let's go back to Andrex studio and then let's go to this update.

173
00:12:16,230 --> 00:12:18,490
Martial art activity class here.

174
00:12:18,490 --> 00:12:24,230
So inside this class Let's go to this actually Smurfette modify user interface Smurfette.

175
00:12:24,430 --> 00:12:30,190
And inside this for loop we have a for loop here right inside this wall of where we actually at these

176
00:12:30,190 --> 00:12:33,430
user interface components to the grid play out here.

177
00:12:33,730 --> 00:12:38,250
Let's change the width of these user interface components.

178
00:12:38,260 --> 00:12:45,100
So here I want to tell you that for these I-T takes view here I told you that it is going to actually

179
00:12:45,100 --> 00:12:48,640
take 8 percent of the width of the screen.

180
00:12:48,640 --> 00:12:49,810
So it is incorrect.

181
00:12:50,560 --> 00:12:57,880
Because of the device screen with beat by eight this this means that the screen is going to be actually

182
00:12:58,270 --> 00:13:06,040
divided by eight or in other words it's going to create eight parts for the screen and Vaun part of

183
00:13:06,040 --> 00:13:13,300
that eight parts is going to be actually allocated for this Tayseer for this for the ID text view.

184
00:13:13,300 --> 00:13:16,090
So in order to actually say that all you want.

185
00:13:16,090 --> 00:13:20,930
This idea takes you to take only 8 percent of that screen.

186
00:13:21,130 --> 00:13:27,370
Here we need to say Actually let's put a pair of Prentice's he had integer and actually put another

187
00:13:27,380 --> 00:13:35,530
prophetesses here and here I can see screen with multiplied by zero point zero eight.

188
00:13:35,700 --> 00:13:36,230
Right.

189
00:13:36,570 --> 00:13:42,710
But for this application I want the viewer to take only 5 percent of their screen.

190
00:13:42,780 --> 00:13:47,720
So just multiply these values screen with a by value zero point zero five.

191
00:13:47,790 --> 00:13:49,270
OK five persons.

192
00:13:49,620 --> 00:13:57,510
And then here for this actually for the name it takes here I want this name it takes to take only 20

193
00:13:57,520 --> 00:13:58,880
percent of the screen.

194
00:13:58,980 --> 00:14:05,180
So the value of this screen be multiplied by zero point twenty.

195
00:14:05,220 --> 00:14:05,780
OK.

196
00:14:06,090 --> 00:14:11,590
So in this way it's going to actually take only 20 percent of the screen with this name it it takes.

197
00:14:11,610 --> 00:14:18,130
And this price as it takes I want to actually only take 20 percent of that it takes of the screen.

198
00:14:18,170 --> 00:14:19,100
So it is OK.

199
00:14:19,480 --> 00:14:21,120
And this one color as it takes.

200
00:14:21,130 --> 00:14:26,620
I want to I want this user interface component to this as it takes to take only 20 percent of this cleavage.

201
00:14:26,910 --> 00:14:28,340
And it is also OK.

202
00:14:28,680 --> 00:14:34,840
So now this button here all you want this button to take 55 percent of the screen.

203
00:14:35,040 --> 00:14:44,550
So instead of much vitty change 255 55 screen TVs multiplied by 0.35.

204
00:14:44,710 --> 00:14:45,340
Right.

205
00:14:45,350 --> 00:14:46,950
Let's run an application now.

206
00:14:48,210 --> 00:14:49,810
Let me show you the emulator.

207
00:14:50,880 --> 00:14:53,540
So you have seen our application is running on the simulator.

208
00:14:53,670 --> 00:14:58,130
Let's click on the ellipsis button and then let's see we can update the martial arts item.

209
00:14:58,140 --> 00:15:02,460
So now you can see that this idea is taking only 5 percent of their screen TVs.

210
00:15:02,760 --> 00:15:07,490
You can see that this edit takes here for the name is taking 20 percent of the screen.

211
00:15:07,890 --> 00:15:13,680
This one is a price is actually taking a 20 percent of the screen with it.

212
00:15:13,710 --> 00:15:19,130
So not just that that the keyboard here is actually showing us only the numbers the input type of these

213
00:15:19,140 --> 00:15:22,420
edits is actually the number right input type.

214
00:15:22,800 --> 00:15:26,130
Let me show you this while you type class number here.

215
00:15:26,730 --> 00:15:32,790
And this one the color detail is actually only taking 20 percent of the screen width and the spot in

216
00:15:32,790 --> 00:15:36,360
here is taking 45 percent of the screen.

217
00:15:36,510 --> 00:15:44,100
So here when I actually modify or update one of these marginal objects it doesn't show me a toast message

218
00:15:44,130 --> 00:15:47,440
so that the user know that something is updated.

219
00:15:47,460 --> 00:15:51,750
Let's go to Android studio and let's go inside these update martial art activity class.

220
00:15:51,870 --> 00:15:56,000
Let's scroll down here and it's going into these unclean Metford inside these triple.

221
00:15:56,040 --> 00:16:02,280
After calling the Smurfette modified motional object on this database handle the reference I can create

222
00:16:02,310 --> 00:16:08,630
a toast message so toast that make text first we need to pass the context which is going to be update

223
00:16:08,720 --> 00:16:09,760
marshal activity.

224
00:16:09,810 --> 00:16:11,240
This come on.

225
00:16:11,280 --> 00:16:18,630
And then the message and I can say this that update is updated this martial art object is updated.

226
00:16:20,150 --> 00:16:20,800
Right.

227
00:16:20,930 --> 00:16:22,490
And then I put a comma here.

228
00:16:22,640 --> 00:16:26,400
And finally I need to specify the length of this message which is going to be short.

229
00:16:26,440 --> 00:16:31,170
That should let me create a new line here so that you can see these values better.

230
00:16:31,810 --> 00:16:34,970
And here let's run an application again.

231
00:16:35,030 --> 00:16:39,950
So let's go to the actually it's click on this little button and then click and update the martial arts

232
00:16:40,040 --> 00:16:41,270
item.

233
00:16:41,270 --> 00:16:46,960
So here let's for example change the Spock scene to kickboxing chic boxing.

234
00:16:47,840 --> 00:16:48,320
Right.

235
00:16:48,410 --> 00:16:49,780
Let's get you can modify.

236
00:16:50,630 --> 00:16:53,340
As you can see it's just this martial object is updated.

237
00:16:53,570 --> 00:16:54,380
Right.

238
00:16:54,500 --> 00:16:57,170
So now if I click on actually the back button.

239
00:16:57,170 --> 00:17:00,000
So here you can see the device has a batch button here.

240
00:17:00,020 --> 00:17:00,500
Right.

241
00:17:00,530 --> 00:17:03,490
If I click on it now I am inside this main activity class.

242
00:17:03,680 --> 00:17:09,440
And if you for example go to actually the martial arts item here if I click on it you can see that the

243
00:17:09,620 --> 00:17:13,040
value of the item 7 here is kickboxing.

244
00:17:13,250 --> 00:17:19,490
If I you can go back and if I go again to the update the martial arts activity here you can see that

245
00:17:19,700 --> 00:17:25,210
again the value of the name is kickboxing so you can see that the database is actually updated.

246
00:17:25,340 --> 00:17:26,400
Right.

247
00:17:26,420 --> 00:17:27,270
So that's it.

248
00:17:27,530 --> 00:17:29,540
Let's click on by button again.

249
00:17:29,540 --> 00:17:33,290
So now this is our update Monserrat activity class.

250
00:17:33,350 --> 00:17:38,660
So we actually implemented all these classes where we implemented an at motional activity we implemented

251
00:17:38,880 --> 00:17:43,260
delete much of that activity and we also implemented this update emotional activity.

252
00:17:43,430 --> 00:17:46,810
Now it's time to actually implement the main activity here.

253
00:17:46,880 --> 00:17:47,310
Right.

254
00:17:47,360 --> 00:17:52,070
The main screen that is going to be shown to the user for the first time that for example when the user

255
00:17:52,070 --> 00:17:55,130
runs the application this is the activity that is going to be shown to the user.

256
00:17:55,130 --> 00:17:57,570
This is the luncher activity actually.

257
00:17:57,890 --> 00:18:01,150
So let's go back into the studio and let's see what we are going to do next.

