1
00:00:00,440 --> 00:00:01,440
Hi everyone.

2
00:00:01,440 --> 00:00:06,270
So in this story we're going to go ahead and we're going to create another activity called Delete martial

3
00:00:06,270 --> 00:00:07,690
arts activity.

4
00:00:08,010 --> 00:00:14,150
So first of all let's go to this martial martial art class and let's modify this to stream of it.

5
00:00:14,220 --> 00:00:24,350
So instead of actually retaining this value let's actually first get the martial art ID plus two chords

6
00:00:24,390 --> 00:00:34,920
space plus get Martia that name plus two coats space plus get martial arts price plus two coats space

7
00:00:35,130 --> 00:00:38,810
plus and finally get Marshall at color.

8
00:00:38,840 --> 00:00:42,440
So let me create a new line here so that you can see what's going on here.

9
00:00:42,440 --> 00:00:43,610
Exactly.

10
00:00:43,610 --> 00:00:46,190
So first we want to out with this idea you get Marshall.

11
00:00:46,220 --> 00:00:49,950
The Marshall name Marshall Price and Marshall add color.

12
00:00:50,030 --> 00:00:55,440
So let's open the Android view here if you want to add that up in here you can just click on viewtiful

13
00:00:55,460 --> 00:00:58,170
windows and then click on a project.

14
00:00:58,460 --> 00:01:01,520
So here let's open this up for their Java.

15
00:01:01,820 --> 00:01:03,340
And here look at this first package.

16
00:01:03,350 --> 00:01:09,850
Just select this package here you can right click on this package and click on new activity.

17
00:01:09,990 --> 00:01:10,700
Activity.

18
00:01:10,890 --> 00:01:17,240
Actually the empty activity or you can just select this package or the top menu is going to find new

19
00:01:17,930 --> 00:01:21,790
activity and select empty activity.

20
00:01:21,800 --> 00:01:27,600
So here we need to specify the name of this activity which is going to be delete martial arts divied

21
00:01:27,620 --> 00:01:29,920
martial art activity.

22
00:01:31,630 --> 00:01:32,160
Right.

23
00:01:32,470 --> 00:01:37,570
So here it's going to generate a lay out File for us automatically activity like delete Underland martial

24
00:01:37,580 --> 00:01:39,000
art.

25
00:01:39,150 --> 00:01:44,080
Not going to be allowed to a lot of activity it's going to be backwards compatibility.

26
00:01:44,340 --> 00:01:49,490
This Richard is going to be in a belt this package is here you can see this package here.

27
00:01:49,490 --> 00:01:51,530
This is it is ok is fine.

28
00:01:51,590 --> 00:01:54,380
Just click on finish.

29
00:01:54,420 --> 00:02:01,410
So now all martial art activity class is created for us automatically and a layout file is also created

30
00:02:01,410 --> 00:02:02,750
for us automatically.

31
00:02:02,940 --> 00:02:08,080
And this activity is added to the manifest file automatically so we don't have to do anything here.

32
00:02:08,130 --> 00:02:14,100
We just need to create the activity here and the Android studio is going to do the rest for us.

33
00:02:14,100 --> 00:02:20,220
So now that we have this delete martial art activity class we are not going to design the user interface

34
00:02:20,280 --> 00:02:27,030
ourselves because we do not know we do not know that how many emotional objects exist to be that needs

35
00:02:27,030 --> 00:02:28,010
to be deleted.

36
00:02:28,350 --> 00:02:32,190
So if you are going to design the user interface programmatically.

37
00:02:32,510 --> 00:02:33,000
OK.

38
00:02:33,170 --> 00:02:35,990
We are not going to work with this at much of the activity here.

39
00:02:36,030 --> 00:02:42,780
For example adding Abati and what it takes you or it radio button you are going to design the user interface

40
00:02:43,020 --> 00:02:45,330
by using Jobar quotes.

41
00:02:45,390 --> 00:02:48,600
So let's go to this Tillett martial arts activity class.

42
00:02:48,600 --> 00:02:52,090
Let me double click on the tap here in order to make this area wider.

43
00:02:52,110 --> 00:02:56,510
First of all we need to have a variable of type database handler inside this class.

44
00:02:56,520 --> 00:03:03,120
So here inside this class lets actually say private database handler and the name of this variable is

45
00:03:03,120 --> 00:03:04,870
database handler semi-colon.

46
00:03:04,890 --> 00:03:10,170
Let's go to this uncreate Smurfette and let's initialize this value that we declared inside this class

47
00:03:10,170 --> 00:03:17,250
so database handler assignment operator new database handler and then we need to pass the context which

48
00:03:17,250 --> 00:03:22,450
is going to be delete much of that activity that this semicolon.

49
00:03:22,560 --> 00:03:25,550
Now we need to create a method here.

50
00:03:25,560 --> 00:03:27,300
Look at this method here says content view.

51
00:03:27,300 --> 00:03:33,960
Right now we need to create an effort in order to actually update the user interface in order to modify

52
00:03:33,960 --> 00:03:44,620
the view so the name of this effort is going to be update the user interface user interface and then

53
00:03:44,620 --> 00:03:50,380
put a bit of practice you semicolon so this it here when it is called it's going to update the user

54
00:03:50,380 --> 00:03:57,310
interface according to how many martial art objects that we have inside are a skill like database.

55
00:03:57,310 --> 00:04:03,670
So after the end in curly brace of this on creates Smurfette I'm going to create that method here.

56
00:04:03,730 --> 00:04:12,560
So just typing here private's voit the name of this method is update the user interface just put up

57
00:04:12,570 --> 00:04:18,530
for practice this year and then open and close this method by using these curly braces.

58
00:04:18,540 --> 00:04:24,300
So first of all we are going to get all the marginal objects that are inside of the school like database

59
00:04:24,540 --> 00:04:27,640
so I can't say I released.

60
00:04:27,870 --> 00:04:32,980
So just in the angle brackets specified the data type of the optics that are going to be inside these

61
00:04:33,010 --> 00:04:34,830
are aliased martial arts.

62
00:04:35,070 --> 00:04:43,330
The name of this rowdier it is going to be all martial art objects all martial art objects assignment

63
00:04:43,330 --> 00:04:44,280
operator.

64
00:04:44,380 --> 00:04:47,630
So we have a reference to the state of his handler right.

65
00:04:47,680 --> 00:04:54,380
So I can't say database handler that return all emotional objects semi-colon.

66
00:04:54,490 --> 00:04:56,770
That's as simple as that.

67
00:04:56,770 --> 00:04:58,370
Let me create a line here.

68
00:04:58,750 --> 00:05:05,230
So now this valuable holds all the martial art objects that are inside our database if any exist actually.

69
00:05:05,290 --> 00:05:11,330
So now I can say we need to create a variable of type relatively or an object of type relatively.

70
00:05:11,380 --> 00:05:17,290
Because we want to design the user interface programmatically so relatively out and an image of this

71
00:05:17,290 --> 00:05:17,560
rally.

72
00:05:17,570 --> 00:05:18,550
But it's relatively out.

73
00:05:18,550 --> 00:05:24,430
Assignment operator new relatively out and we need to pass the context to this construction of this

74
00:05:24,430 --> 00:05:25,210
relatively.

75
00:05:25,420 --> 00:05:34,250
So the construct the context actually is the lead marshal of activity that this semicolon.

76
00:05:34,300 --> 00:05:36,280
Now let's create a scroll.

77
00:05:36,310 --> 00:05:43,060
So just type in here scroll view and the name is scroll assignment operator new scroll view.

78
00:05:43,150 --> 00:05:50,090
So let's pass the context which is going to be delete martial art activity that this semicolon.

79
00:05:50,380 --> 00:05:57,070
So here the reason that we created this scroll view here is that we don't know how many martial art

80
00:05:57,160 --> 00:06:00,090
objects are actually inside their school or database.

81
00:06:00,250 --> 00:06:05,930
So we want to allow the user to scroll and see all the objects inside the scroll view.

82
00:06:06,160 --> 00:06:10,660
So let's actually add some more lines of code here.

83
00:06:10,970 --> 00:06:13,220
Let's create a radio group.

84
00:06:13,240 --> 00:06:20,050
So I want to show the user the martial art martial objects as a radio buttons so that when they use

85
00:06:20,040 --> 00:06:26,120
it actually the purchase or clicks on one of those radio buttons that object is going to be deleted

86
00:06:26,150 --> 00:06:28,090
completely from there so like database.

87
00:06:28,100 --> 00:06:29,240
And from the view.

88
00:06:29,440 --> 00:06:36,740
So radio group radio group assignment operator new radio group and me to pass the context which is did

89
00:06:36,740 --> 00:06:41,050
it Marshal activity that this semi-colon.

90
00:06:41,520 --> 00:06:48,570
So now let's create a fully in loop in order to iterate over each object that we have inside this Adelies

91
00:06:48,660 --> 00:06:50,030
all of objects.

92
00:06:50,160 --> 00:06:51,890
So I can't say for.

93
00:06:52,260 --> 00:07:00,730
So let's create a variable of type martial art and then here martial art co-lead all martial art objects.

94
00:07:01,080 --> 00:07:04,340
So just open and close this fall in love by using this curly braces.

95
00:07:04,410 --> 00:07:09,360
So here let's create an object of type radio button so just type in here.

96
00:07:09,450 --> 00:07:14,970
Radio button radio button assignment operator Neo radio button.

97
00:07:15,090 --> 00:07:15,520
Right.

98
00:07:15,650 --> 00:07:21,610
And now let's pass the context which is this one did Marshal activity that this semicolon.

99
00:07:21,660 --> 00:07:25,140
Now it's time to set the I.D. of this radio button.

100
00:07:25,140 --> 00:07:29,530
So a radio button that said I.D..

101
00:07:30,180 --> 00:07:33,520
So the ID is going to be the ID of the martial art object.

102
00:07:33,540 --> 00:07:35,840
So we have this martial art object here right.

103
00:07:35,910 --> 00:07:42,090
So not is that this fall in love here is going to be executed for each martial art object that we have

104
00:07:42,100 --> 00:07:44,670
inside is Aurelia's all martial art objects.

105
00:07:44,730 --> 00:07:45,200
OK.

106
00:07:45,270 --> 00:07:50,400
So for the first time that this fall is going to be executed this very well martial art is going to

107
00:07:50,400 --> 00:07:57,870
hold the first object that we have inside this artist and it's going to continue executing this up until

108
00:07:57,870 --> 00:08:02,480
it reaches to the final object to this that is actually inside of this.

109
00:08:02,490 --> 00:08:07,380
All martial artists are released and it's going to execute that and then it's going to finish executing

110
00:08:07,380 --> 00:08:08,040
this portal.

111
00:08:08,190 --> 00:08:15,390
So if you want to specify the ID of this video and so notice that for each martial art object you are

112
00:08:15,390 --> 00:08:17,500
creating a new radio about it here.

113
00:08:17,580 --> 00:08:18,020
Right.

114
00:08:18,060 --> 00:08:19,810
Look at this line of code here.

115
00:08:20,070 --> 00:08:22,620
So you want to specify the radio button.

116
00:08:22,680 --> 00:08:27,860
So let's actually change this name the name of the city within to current radio button.

117
00:08:27,860 --> 00:08:31,610
It is more meaningful current radio button.

118
00:08:31,710 --> 00:08:39,930
Now lets say current radio button that said ID that I can refer to is martial art here martial arts

119
00:08:40,560 --> 00:08:44,900
that get martial art ID thats it.

120
00:08:44,910 --> 00:08:53,430
Now lets specify the text of this video and so current radio button that said text and the text is actually

121
00:08:53,730 --> 00:08:58,830
the text of our motion of objects so the two string Meffert that we overnighted inside their martial

122
00:08:58,830 --> 00:08:59,370
art class.

123
00:08:59,490 --> 00:09:02,920
So I can say martial art taught to strange.

124
00:09:02,950 --> 00:09:03,470
Thats it.

125
00:09:05,110 --> 00:09:10,920
And finally you are going to add this radio button to our radio group that we created here in line number

126
00:09:10,930 --> 00:09:17,100
58 so you already know how to use radio groups and radio buttons in the previous sections of this course.

127
00:09:17,110 --> 00:09:22,580
I talked about this concept that how we can use radio groups and radio buttons in Android.

128
00:09:22,840 --> 00:09:30,220
So here I just need to say radio group that at VU radio about in.

129
00:09:30,300 --> 00:09:30,990
Right.

130
00:09:31,350 --> 00:09:38,670
So after the end in curly brace of this for a loop here I'm going to actually create a listener for

131
00:09:38,670 --> 00:09:42,590
this radio group for the radio buttons that we have inside that radio group.

132
00:09:42,600 --> 00:09:46,770
So if anybody when whenever to use that I should interact with those radio buttons.

133
00:09:46,980 --> 00:09:48,110
We are going to be notified.

134
00:09:48,120 --> 00:09:52,050
This class with Marshal activity class is going to be notified about that.

135
00:09:52,350 --> 00:10:00,480
So I can actually refer to this radio group radio group that said on ticket change to the center now

136
00:10:00,480 --> 00:10:01,740
we need to pass the context.

137
00:10:01,740 --> 00:10:04,490
The context is this one delete martial art.

138
00:10:04,740 --> 00:10:06,610
That me actually pass the context here.

139
00:10:07,620 --> 00:10:10,690
Delete Marshlack of that activity that this.

140
00:10:11,010 --> 00:10:15,540
But here because we passed this contest which is going to be the listener right that this class is going

141
00:10:15,540 --> 00:10:19,060
to be the listener to the interaction of the user with the radio group.

142
00:10:19,170 --> 00:10:19,550
Right.

143
00:10:19,560 --> 00:10:23,010
This class is going to be notified when the user interacts with you.

144
00:10:23,160 --> 00:10:31,170
So because of that this class marshal activity class must implement their own check to change listener

145
00:10:31,200 --> 00:10:32,280
interface.

146
00:10:32,640 --> 00:10:40,140
So let's scroll to the top here and here it is Marshal activity extends accompted activity implements

147
00:10:41,440 --> 00:10:45,470
on take the change the center on chinked change.

148
00:10:45,580 --> 00:10:50,320
Listener radio group that unchecked change this and that this is really important.

149
00:10:50,430 --> 00:10:56,480
OK ladies if that unchecked change isn't so because now this class did most of the activity class is

150
00:10:56,510 --> 00:11:02,780
implemented this interface that did Marshal of activity class must implement the method which is going

151
00:11:02,780 --> 00:11:07,270
to be unchecked to change Mefford that is inside of this interface so let's scroll down here.

152
00:11:07,460 --> 00:11:13,870
And before the end in calibers of this emotional activity class we are going to actually implement that

153
00:11:13,870 --> 00:11:17,480
effort and take it change this and unchecked change.

154
00:11:17,480 --> 00:11:17,960
Listen.

155
00:11:18,260 --> 00:11:20,700
So this is the Meffert and this if it has to.

156
00:11:20,740 --> 00:11:23,720
PRIME MINISTER We can see the first one is Radio Group group.

157
00:11:23,960 --> 00:11:26,870
It is and the second argument is checked ID.

158
00:11:27,230 --> 00:11:30,330
So let's go inside this method and let's see what we are going to do now.

159
00:11:30,350 --> 00:11:38,270
So we already created an instance of type database handler so I can say database handler that deletes

160
00:11:39,500 --> 00:11:44,220
data was handled that delete Mazzara object from database by ID.

161
00:11:44,270 --> 00:11:48,030
So we need to pass the ID of a specific Matia object to be deleted.

162
00:11:48,290 --> 00:11:49,200
And look at this method.

163
00:11:49,220 --> 00:11:53,680
This method has an argument of type integer and is and it is checked ID.

164
00:11:53,870 --> 00:11:56,890
OK the ID of of that specific radio about it.

165
00:11:57,110 --> 00:11:58,660
So I can pass the idea here.

166
00:11:58,710 --> 00:12:04,890
Check ID VOIP you can pass this ID because here inside is updates the user interface method.

167
00:12:05,260 --> 00:12:06,470
Inside this for a loop.

168
00:12:06,560 --> 00:12:11,960
We actually created our radio button for each monster that object that we have inside this Aurelia's

169
00:12:11,990 --> 00:12:12,470
right.

170
00:12:12,530 --> 00:12:15,630
This really gets all module objects from this method from the database.

171
00:12:15,920 --> 00:12:22,340
So here we said that the ID of that radio button is the same ID as that martial art object that we have

172
00:12:22,340 --> 00:12:23,440
inside the database.

173
00:12:23,450 --> 00:12:27,770
So thats why if we passed the idea here checked ID of that button.

174
00:12:27,890 --> 00:12:34,140
It is going to delete that specific object with that specific ID inside the database.

175
00:12:34,340 --> 00:12:35,320
Right.

176
00:12:35,450 --> 00:12:43,860
So thats why it is more it is actually a very precise method a very precise way in order to delete up

177
00:12:44,000 --> 00:12:47,720
a specific motion of object from our database.

178
00:12:47,720 --> 00:12:52,670
So after this line of code here I can see so not just that if this doesnt make sense for now toward

179
00:12:52,680 --> 00:12:55,650
Florida you can always ask questions from me.

180
00:12:55,650 --> 00:12:59,990
You can send me a message and you to me or you can just post the discussion to the course and then I

181
00:12:59,990 --> 00:13:05,150
do my best to answer all of your questions and make sure to watch this section of the tutorials over

182
00:13:05,150 --> 00:13:09,200
and over again in order to understand what's going on here exactly.

183
00:13:09,290 --> 00:13:09,780
OK.

184
00:13:10,190 --> 00:13:16,670
So now after this and what I can say create a toast message in order to let the user know that that

185
00:13:16,730 --> 00:13:19,160
specific martial art object is actually deleted.

186
00:13:19,250 --> 00:13:27,110
So I can't say post does it make text and first we need to pass the context so the context is that much

187
00:13:27,110 --> 00:13:32,820
of that activity that this comma the text is going to be the Marshall object is deleted.

188
00:13:32,870 --> 00:13:36,680
Marshall object to martial art.

189
00:13:37,730 --> 00:13:42,260
Object is the word karma.

190
00:13:42,340 --> 00:13:46,500
Finally if it is specified the length short that shock.

191
00:13:46,870 --> 00:13:47,310
Right.

192
00:13:47,500 --> 00:13:49,570
So let me create a new line here.

193
00:13:50,410 --> 00:13:51,040
So that's it.

194
00:13:51,070 --> 00:13:51,610
This is.

195
00:13:51,680 --> 00:13:56,050
Unchecked change my fate then the user actually interacts with the radio buttons that are instead of

196
00:13:56,050 --> 00:13:56,990
the radio group.

197
00:13:57,050 --> 00:13:58,620
This is going to be executed.

198
00:13:58,630 --> 00:14:01,570
So it's going to delete that much object from our database.

199
00:14:01,600 --> 00:14:06,490
So let's go back to our Mefford updates the user interface my 5th here after this line of code that

200
00:14:06,490 --> 00:14:09,800
sets the listener up for these radio call here.

201
00:14:09,810 --> 00:14:11,960
I can say.

202
00:14:12,140 --> 00:14:17,190
So let's create our new button inside our layout.

203
00:14:17,190 --> 00:14:21,900
Delete most of that activity actually so that when that user wants to for example go back to the main

204
00:14:21,900 --> 00:14:22,920
activity class.

205
00:14:23,040 --> 00:14:27,680
These are the can just easily click or touch that button in order to go back to that activity.

206
00:14:27,930 --> 00:14:34,710
But the Andretti were all the Android devices actually have the have the capability to allow the user

207
00:14:34,710 --> 00:14:36,630
to go back to their previous activity.

208
00:14:36,750 --> 00:14:37,360
OK.

209
00:14:37,920 --> 00:14:40,760
But we want to actually create that button here.

210
00:14:40,770 --> 00:14:47,580
I want to show you how we can create that button inside your layout and just allow the user to interact

211
00:14:47,580 --> 00:14:48,550
with that button.

212
00:14:48,570 --> 00:14:53,270
So let's create a button button PTEN back button PTEN back.

213
00:14:53,330 --> 00:14:53,930
Right.

214
00:14:53,970 --> 00:14:59,640
Assignment operator new button we need to pass the context so the context is did sort of activity that

215
00:14:59,670 --> 00:15:01,490
this semi-colon.

216
00:15:01,860 --> 00:15:04,760
So now when it is specified the text of this button.

217
00:15:04,770 --> 00:15:08,860
So just I mean he had and back that said text.

218
00:15:09,240 --> 00:15:14,390
So the text is going to be go back go back right.

219
00:15:15,810 --> 00:15:22,380
And then here I can say PTEN batch that set and click listener.

220
00:15:22,830 --> 00:15:25,140
So here we need to pass the context.

221
00:15:25,290 --> 00:15:28,400
So the context is going to be actually the listener right.

222
00:15:28,410 --> 00:15:32,450
So the listener is meant to be delit marshal that activity that this.

223
00:15:32,820 --> 00:15:39,530
So because this sort of the activity class is going to be the listener of the clicks of the touches

224
00:15:39,570 --> 00:15:42,600
or the interactions of the user with this button.

225
00:15:42,660 --> 00:15:47,100
This class must implement the view that unclick the center interface.

226
00:15:47,220 --> 00:15:48,730
So let's scroll to the top here.

227
00:15:48,900 --> 00:15:57,360
And after implementing this interface let's put a comma and now I can't say view does unclick listener

228
00:15:59,470 --> 00:16:05,050
so because now this class delete my social activity class is implementing this interface we need to

229
00:16:05,500 --> 00:16:07,000
overwrite the uncle or my friend here.

230
00:16:07,000 --> 00:16:08,010
So let's scroll down here.

231
00:16:08,050 --> 00:16:14,460
And before the curly brace of the still emotional acuity class I can just step in here and click.

232
00:16:14,890 --> 00:16:16,040
So override this method.

233
00:16:16,210 --> 00:16:19,310
And here I can just say finish.

234
00:16:19,840 --> 00:16:26,440
So by calling this if it finish this do it much like if the class is going to be finished and it's going

235
00:16:26,440 --> 00:16:32,770
to be eliminated so that the user so that they actually the lay out or the activity below this activity

236
00:16:32,770 --> 00:16:34,080
is going to be shown to the user.

237
00:16:34,180 --> 00:16:34,710
Right.

238
00:16:34,730 --> 00:16:39,120
So I notice that activities are going to be on top of each other.

239
00:16:39,310 --> 00:16:39,590
OK.

240
00:16:39,590 --> 00:16:46,300
When we open another activity the new activity is going to be on top of the previous activity so when

241
00:16:46,300 --> 00:16:51,850
we finished the current activity that the previous activity is going to be shown to the user.

242
00:16:51,850 --> 00:16:53,700
So we call finish method here.

243
00:16:53,740 --> 00:16:55,690
So let's scroll to the top here.

244
00:16:55,690 --> 00:17:02,530
So now that we have this in our fourth expedient patch method here I can say scroll view thought at

245
00:17:02,690 --> 00:17:05,180
view radio group.

246
00:17:05,320 --> 00:17:11,680
So if you are adding this radio group that actually contains all the radio buttons that we created here

247
00:17:12,100 --> 00:17:16,520
inside this will loop this radio clip contains all those radio buttons.

248
00:17:16,540 --> 00:17:21,340
Now you are adding this radio group to this scroll view so that the user can actually scroll between

249
00:17:21,370 --> 00:17:26,330
all these radio buttons or for example we have thousands of radio buttons.

250
00:17:26,350 --> 00:17:29,550
These are then scroll and see all those objects.

251
00:17:29,890 --> 00:17:32,460
So now I can say after this line of code.

252
00:17:32,740 --> 00:17:40,090
So now that we have this spot in here and patch let's specify the feet and the height and the position

253
00:17:40,120 --> 00:17:42,000
of the spot and inside are relatively.

254
00:17:42,030 --> 00:17:46,260
So remember that we have a relatively out we created here right.

255
00:17:46,270 --> 00:17:52,090
And we also have a scroll view this closely holds the radio group and the relatively out holds the scroll

256
00:17:52,090 --> 00:17:53,240
view right.

257
00:17:53,260 --> 00:17:58,370
So first of all let's specify the width and height and the position of this button back button here.

258
00:17:58,510 --> 00:18:02,070
So below this line of code that actually adds the radio group to the scroll view.

259
00:18:02,260 --> 00:18:11,270
I can see relatively out relatively out but lay out palms and the name of this table is going to be

260
00:18:11,410 --> 00:18:13,490
Potin problems.

261
00:18:13,770 --> 00:18:18,790
OK because I want to specify it it's and the height of this button assignment operator and again just

262
00:18:18,790 --> 00:18:24,820
like in here relatively out thought lay out perhaps and put a pair of practice this year.

263
00:18:24,830 --> 00:18:29,690
I'm going to to specify the beat as the first argument and the second argument is the height.

264
00:18:29,690 --> 00:18:33,940
So here are I actually forgot to put the new keyword here.

265
00:18:34,070 --> 00:18:35,610
So make sure to put in if you were here.

266
00:18:35,630 --> 00:18:42,380
So a new relatively to lay out for pullups and for the first argument I'm going to pass the value relatively

267
00:18:42,380 --> 00:18:47,120
out that let's put arms towards that content.

268
00:18:47,160 --> 00:18:47,480
OK.

269
00:18:47,510 --> 00:18:51,340
This is the weight of the button inside on electively out karma.

270
00:18:52,040 --> 00:18:56,220
And again relatively out does lay out palms.

271
00:18:56,440 --> 00:18:58,650
Does that content so this is the height of.

272
00:18:58,660 --> 00:18:59,510
But it's simply called.

273
00:18:59,590 --> 00:19:05,620
So let create actually a new line here so that you can see what's going on here exactly.

274
00:19:05,620 --> 00:19:09,530
So this is are actually at the height the button pumps right.

275
00:19:10,760 --> 00:19:14,470
So let's specify the position of this spot inside our relatives.

276
00:19:14,720 --> 00:19:20,750
I want this button to be at the bottom of the relativity of the at the bottom of the layout so I can

277
00:19:20,750 --> 00:19:24,140
say I can refer to this button perhaps here button.

278
00:19:25,470 --> 00:19:34,150
Prompts that add rule relatively out that actually align parent bottom.

279
00:19:34,170 --> 00:19:39,410
So it's going to align this button to the bottom of the pattern which is going to be the relatively

280
00:19:39,430 --> 00:19:40,110
out right.

281
00:19:40,110 --> 00:19:45,260
We're going to put the bottom inside relatively so that it's relatively or is the parent of the button.

282
00:19:45,270 --> 00:19:53,070
So if you are going to align the button to the bottom of the parent switches is this one and we're going

283
00:19:53,070 --> 00:20:01,980
to also position this button I should be at the center horizontal so potent parents that are the rule

284
00:20:02,790 --> 00:20:08,090
relatively out that center horizontal center part isn't.

285
00:20:08,090 --> 00:20:11,750
Now let's specify the margins of this.

286
00:20:11,780 --> 00:20:18,950
So I can't say but Pomerantz that set margins and here for the first value of it is specified the left

287
00:20:18,950 --> 00:20:21,260
margin is going to be zero comma.

288
00:20:21,530 --> 00:20:23,740
And then I mean to specify the top management again.

289
00:20:23,860 --> 00:20:27,490
Zero comma the right margin zero comma.

290
00:20:27,680 --> 00:20:31,640
And that Bardell Margene we are going to pass the values 70.

291
00:20:31,770 --> 00:20:32,620
OK.

292
00:20:32,930 --> 00:20:33,480
And that's it.

293
00:20:33,500 --> 00:20:38,580
This is our bottom margin of the button here.

294
00:20:38,630 --> 00:20:42,160
So now it's time to add this Spartan that we created here.

295
00:20:42,230 --> 00:20:44,900
These poems two are relative they are.

296
00:20:44,960 --> 00:20:53,340
So you can say relatively out that at view PTEN back comma and that we need to actually pass the pot.

297
00:20:53,410 --> 00:20:56,870
We're using this version of this method the child and the output.

298
00:20:56,900 --> 00:20:59,790
So we created this part perhaps here 14 polyps.

299
00:20:59,960 --> 00:21:00,850
That it.

300
00:21:01,250 --> 00:21:05,330
And finally we need to specify the port arms.

301
00:21:05,360 --> 00:21:10,860
Actually it is clearly a part of the scroll view because we want to put our scroll inside the relativity.

302
00:21:10,890 --> 00:21:15,420
And once there's scroll you to take the entire weight and the entire height of the rel. out.

303
00:21:15,560 --> 00:21:27,200
So I can actually again I can say scroll view does lay out palms that lay out palms the name of this

304
00:21:27,200 --> 00:21:35,020
valuable is going to be scroll viewport arms scroll view prompts assignment operator new scroll view

305
00:21:35,750 --> 00:21:44,830
let's say it is a pair of prentices here thought lay out perhaps scroll view that lay out poems and

306
00:21:44,960 --> 00:21:49,550
here for the video they actually create a new light years or so so that you can see what's going on

307
00:21:49,550 --> 00:21:50,690
here for the video.

308
00:21:50,720 --> 00:22:03,730
I can actually say scroll view that lay out poems that lay out poems that match parent comma scroll.

309
00:22:03,740 --> 00:22:11,990
You thought lay out poems that match parent this is going to be for the height match parent.

310
00:22:12,070 --> 00:22:15,760
So if it's at the height of this scroll view is going to be much parent.

311
00:22:15,790 --> 00:22:18,290
So let's put a semicolon here at the end of our statement.

312
00:22:18,550 --> 00:22:26,830
And here I can add this scroll view to the relatively out so I can say relatively out that ad view scroll

313
00:22:26,830 --> 00:22:28,490
view right.

314
00:22:30,240 --> 00:22:36,230
Also want to pass the parts that you created here so put a comma here and just type in here scroll Vieuxtemps

315
00:22:36,660 --> 00:22:41,560
OK at this scroll view these poems that relatively out here.

316
00:22:41,570 --> 00:22:47,780
And finally we are going to say that this layout that he created here inside the Smurfit is going to

317
00:22:47,780 --> 00:22:50,380
be the layout that we want to have.

318
00:22:50,420 --> 00:22:50,920
OK.

319
00:22:51,020 --> 00:22:53,000
So I can't see so I look at it.

320
00:22:53,000 --> 00:22:53,890
Scroll to the top here look.

321
00:22:53,930 --> 00:22:54,460
Look at this.

322
00:22:54,550 --> 00:22:57,090
Here uncreate this if it is called it's contents.

323
00:22:57,090 --> 00:23:01,850
If you order to lay out that activity underline did it Underland Marshall other landmarks other than

324
00:23:01,850 --> 00:23:02,630
art actually.

325
00:23:02,660 --> 00:23:07,370
So this method is going to be called in order to show that they are true to use user when the uncreate

326
00:23:07,370 --> 00:23:07,970
and if it is called.

327
00:23:07,970 --> 00:23:08,520
Right.

328
00:23:08,690 --> 00:23:11,050
But here inside is uncreate me.

329
00:23:11,120 --> 00:23:11,630
I said that.

330
00:23:11,630 --> 00:23:12,160
OK.

331
00:23:12,210 --> 00:23:18,990
All you want this to be called and if it is called You're actually designing the user interface programmatically

332
00:23:18,990 --> 00:23:22,700
we are adding the scroll view the relatively out radio groups the button.

333
00:23:22,700 --> 00:23:30,400
So here at the end if you're going to call this method set content view relatively at that me actually

334
00:23:30,410 --> 00:23:32,830
put it you said content view relatively.

335
00:23:33,380 --> 00:23:34,100
That's it.

336
00:23:34,100 --> 00:23:38,390
Now in this way we are designing the user interface programmatically.

337
00:23:38,390 --> 00:23:43,110
And before we run the application here let me tell you that insight is unchecked.

338
00:23:43,130 --> 00:23:44,170
Change method.

339
00:23:44,180 --> 00:23:49,400
So for example when it interacts with the radio button in say the radio group of any use it for example

340
00:23:50,000 --> 00:23:53,060
just clicks or touches one of those radio buttons.

341
00:23:53,890 --> 00:23:59,880
The martial art object that is related to the idea of that radio button is going to be deleted from

342
00:23:59,880 --> 00:24:00,700
our database.

343
00:24:00,900 --> 00:24:01,410
Right.

344
00:24:01,590 --> 00:24:07,200
So that means an object is going to be deleted from all alleles that we have inside is update the user

345
00:24:07,200 --> 00:24:09,510
interface method that means scroll here to the top.

346
00:24:09,510 --> 00:24:10,670
You can see this.

347
00:24:10,930 --> 00:24:13,240
Let's look at this line of code here in line number 58.

348
00:24:13,240 --> 00:24:20,000
We created a variable of the released and its name is all almost all objects and we get is almost all

349
00:24:20,050 --> 00:24:23,300
motional objects from the Smurfette return all martial art objects.

350
00:24:23,790 --> 00:24:28,470
So according to this release we are creating a great deal about radio buttons right.

351
00:24:28,470 --> 00:24:34,620
So when a modular object is actually deleted from our database This means that we are going to have

352
00:24:35,460 --> 00:24:40,160
for example we are not going to have a radio button for that emotional object.

353
00:24:40,410 --> 00:24:48,050
So here when they use it for example it's one of those Monserrat objects you want to also update the

354
00:24:48,050 --> 00:24:48,770
user interface.

355
00:24:48,780 --> 00:24:55,340
You're inside the Smurfit so that the user interface is going to show the martial art objects of all

356
00:24:55,550 --> 00:25:02,000
the radio buttons that are related to the monitor the optics that are actually inside our database not

357
00:25:02,000 --> 00:25:04,200
the Monserrat objects that are deleted.

358
00:25:04,250 --> 00:25:08,980
So it's necessary to call this method here inside this unchecked change if it below it is at the top

359
00:25:09,310 --> 00:25:10,680
of that matrix method.

360
00:25:11,000 --> 00:25:12,100
So that's it.

361
00:25:12,110 --> 00:25:14,920
Now let's run an application and let's see what happens.

362
00:25:15,080 --> 00:25:16,500
Let me show you the emulator.

363
00:25:16,700 --> 00:25:20,090
So here you can see that our application is running on the simulator.

364
00:25:20,090 --> 00:25:21,030
Let's click on.

365
00:25:21,080 --> 00:25:26,510
Actually let me click on this dropdown menu and here click on delete the martial art as you can see.

366
00:25:26,510 --> 00:25:27,410
Nothing happened.

367
00:25:27,410 --> 00:25:28,060
Why.

368
00:25:28,070 --> 00:25:33,800
Because we didn't add the code to transition to the delete marshal or activity class when the user actually

369
00:25:33,980 --> 00:25:35,090
clicks on that.

370
00:25:35,250 --> 00:25:37,380
Actually menu item he had distilled it to.

371
00:25:37,430 --> 00:25:38,870
But in this item.

372
00:25:38,870 --> 00:25:42,380
So let's go to the actually to the main activity class.

373
00:25:42,380 --> 00:25:45,020
Let me open the Android view on here.

374
00:25:45,200 --> 00:25:46,490
Let's go to the main activity class.

375
00:25:46,490 --> 00:25:49,330
Let me double click on the stop here in order to make this area wider.

376
00:25:49,640 --> 00:25:53,710
So here look at this for an option I then selected.

377
00:25:53,720 --> 00:25:54,560
Right.

378
00:25:54,590 --> 00:25:56,110
So we have this case a statement.

379
00:25:56,120 --> 00:25:59,750
If the user for example touches the monster that item.

380
00:25:59,880 --> 00:26:07,770
Now it's time to add another case statement case or that Id dot delete martial art.

381
00:26:07,780 --> 00:26:10,510
Art did it martial of martial art.

382
00:26:10,690 --> 00:26:14,850
COLIN So this item is for any use that actually clicks or touches.

383
00:26:14,880 --> 00:26:21,620
This idea that martial art and in here can create an intent and the name of this intent is going to

384
00:26:21,620 --> 00:26:26,700
be delete martial arts intent.

385
00:26:27,370 --> 00:26:34,130
Assignment operator new intent and we need to pass the context which is going to be main activity that

386
00:26:34,130 --> 00:26:40,280
this comma and the second argument is going to be to actually the activity that we want to transition

387
00:26:40,280 --> 00:26:40,720
to.

388
00:26:40,720 --> 00:26:43,900
David Marshall that activity that class semicolon.

389
00:26:43,900 --> 00:26:46,070
So let me create a new line here.

390
00:26:46,500 --> 00:26:49,970
So now I can just say it starts activity.

391
00:26:50,150 --> 00:26:56,270
Martial marshal activity intense martial art intellectually and then here I just need to return TRUE

392
00:26:56,540 --> 00:26:59,340
return TRUE semicolon.

393
00:26:59,600 --> 00:27:01,550
So now let's an old application.

394
00:27:01,910 --> 00:27:06,170
So as you can see here our application is running on this emulator.

395
00:27:06,410 --> 00:27:09,910
Now I want you to actually take a look at this.

396
00:27:10,070 --> 00:27:15,470
Actually the emulator here our application is going to crash if we want to transition to the Delete

397
00:27:15,590 --> 00:27:17,030
the Marshlack activity.

398
00:27:17,600 --> 00:27:21,130
And I want you to pause the video and debug the application.

399
00:27:21,130 --> 00:27:24,440
If I click on it again here delete the martial art as you can see.

400
00:27:24,440 --> 00:27:31,770
Now my app is going to crash if I go to address you here and if I click on Android monitor here it's

401
00:27:31,770 --> 00:27:36,480
going to actually show me here why our application crash if I scroll down here we can see look at these

402
00:27:36,480 --> 00:27:37,230
links here.

403
00:27:37,230 --> 00:27:41,060
It says delete marshal activity Java line 32.

404
00:27:41,280 --> 00:27:45,660
So it says this line of code he had this method this method calling update the user interface.

405
00:27:45,680 --> 00:27:47,440
If it is the cause of this error.

406
00:27:47,640 --> 00:27:52,070
And we have this linkage delit monitor that activated the Java line 50.

407
00:27:52,080 --> 00:27:57,600
So here now it is inside this update the user interface Smurfette and the cause of this error is this

408
00:27:57,600 --> 00:27:59,660
line of code here in line number 50.

409
00:27:59,910 --> 00:28:03,980
Mistakenly I added a radio group to the radio group here.

410
00:28:04,020 --> 00:28:06,570
I must add late you bought into the radio.

411
00:28:06,570 --> 00:28:12,720
Actually the current radio button so radio that your radio call and radio button.

412
00:28:12,740 --> 00:28:13,190
OK.

413
00:28:13,350 --> 00:28:17,510
Now if I run the application again if I actually click on this dropdown menu.

414
00:28:17,520 --> 00:28:19,470
Now if I click on delete a martial art..

415
00:28:19,470 --> 00:28:23,530
Now here we can see these marginal objects inside the scroll view.

416
00:28:23,580 --> 00:28:25,960
We have these Colebatch but in here at the bottom.

417
00:28:26,250 --> 00:28:32,450
So you can see here the ID of the first object of the first actually the radio button is one box and

418
00:28:32,820 --> 00:28:33,570
this is the prize.

419
00:28:33,570 --> 00:28:34,940
This is the color here.

420
00:28:34,980 --> 00:28:38,920
If I click on one of them you can see that it's a marshal object is deleted.

421
00:28:38,970 --> 00:28:43,990
If I click on this one it is actually deleted this one and this one right.

422
00:28:44,070 --> 00:28:47,870
If I click on go back now you can see this is our main activity here.

423
00:28:48,120 --> 00:28:52,280
Let's go to outmuscle update and let's add another object here.

424
00:28:52,290 --> 00:28:56,780
Boxing and martial art place for example 2000.

425
00:28:56,910 --> 00:28:59,960
The modular color for example blue here.

426
00:28:59,970 --> 00:29:03,640
If I click on at it it is going to add that to our database.

427
00:29:05,010 --> 00:29:07,960
And if I click on it again it is going to add that to our database.

428
00:29:07,980 --> 00:29:11,790
So let's add for example a bunch of Marshlack objects through our database.

429
00:29:11,790 --> 00:29:16,380
If I click on back button here now it is our main activity.

430
00:29:16,380 --> 00:29:22,500
Let's go to the little marshal art activity here so you can see now we have a scroll view of all these

431
00:29:22,500 --> 00:29:28,340
martial art objects that are presented to you to the user actually as radio buttons.

432
00:29:28,440 --> 00:29:29,030
Right.

433
00:29:29,100 --> 00:29:34,680
If the user presses on one of these radio buttons here you can see that that specific radio button is

434
00:29:34,680 --> 00:29:35,660
actually deleted.

435
00:29:35,880 --> 00:29:40,230
So for example this one you can see this one is deleted or this one.

436
00:29:40,260 --> 00:29:40,940
So that's it.

437
00:29:40,950 --> 00:29:45,450
If I could I can go back now you can see this is our main activity so thank you very much for watching

438
00:29:45,480 --> 00:29:50,920
it a story are we going to add another activity of the martial arts activity.

439
00:29:51,420 --> 00:29:52,900
So thank you very much for watching.

440
00:29:52,920 --> 00:29:57,360
If you have any questions about the consubstantial touch you so far please post a discussion in the

441
00:29:57,360 --> 00:30:00,090
course and then I do my best to answer all of your questions.

