1
00:00:00,130 --> 00:00:07,140
Hi everyone in this story all you're going to master at the school like an android by creating a production

2
00:00:07,140 --> 00:00:10,560
ready Android application called martial arts club.

3
00:00:10,830 --> 00:00:12,030
So let's create that here.

4
00:00:12,030 --> 00:00:18,480
Let's start in your Android studio project for the application name just they've here had martial arts

5
00:00:18,480 --> 00:00:21,200
club martial arts club.

6
00:00:21,450 --> 00:00:23,560
And here we can specify the company domain.

7
00:00:23,670 --> 00:00:27,980
The package name and project location just click next here.

8
00:00:27,980 --> 00:00:29,820
Choose M.M. as the.

9
00:00:29,910 --> 00:00:35,020
Actually the AP 16 Android 4.1 tiddy been for phone and tablet.

10
00:00:35,070 --> 00:00:37,010
Just click on X here.

11
00:00:37,050 --> 00:00:38,940
Choose basic activity.

12
00:00:38,940 --> 00:00:44,000
This is very important because you want to actually use the menu feature here.

13
00:00:44,070 --> 00:00:50,970
Choose basic activity and then click next so you can specify the activity name layouts name title menu

14
00:00:50,970 --> 00:00:52,030
resource name.

15
00:00:52,200 --> 00:00:57,680
We do not want to use fragment in this application so do not check this checkbox here.

16
00:00:57,810 --> 00:00:59,230
Just click on finish.

17
00:00:59,730 --> 00:01:02,340
So now as you can see here our project is created.

18
00:01:02,340 --> 00:01:04,800
So let me actually switch to the Design tab.

19
00:01:04,800 --> 00:01:06,720
Here you can see our design here.

20
00:01:06,720 --> 00:01:13,260
This is our constraint layout and this is our Takes view at the center of this constrained layout.

21
00:01:13,260 --> 00:01:18,630
So here first of all we want to specify or actually many options.

22
00:01:18,630 --> 00:01:24,040
First let me actually run the application and here choose one of these devices.

23
00:01:24,090 --> 00:01:28,460
Just click on OK so here you can see that our application is running on the simulator.

24
00:01:28,680 --> 00:01:30,880
And here we have this hello world text view.

25
00:01:30,900 --> 00:01:35,490
Here we have these floats in action button which you are not going to use in this application so we

26
00:01:35,490 --> 00:01:41,960
need to delete this faluting action button and we also have this menu button here inside is actually

27
00:01:42,230 --> 00:01:43,260
Abdoulaye out.

28
00:01:43,410 --> 00:01:45,810
If I click on it you can see the settings here.

29
00:01:45,810 --> 00:01:51,000
So let's go to a hundred studio and here inside is lay out for that just double click on the activity

30
00:01:51,010 --> 00:01:58,560
underline minute example let's switch actually to Design tab and here let me zoom out a little bit so

31
00:01:58,560 --> 00:02:03,870
that we can see the entire actually the entire layout here so let me close this Properties window by

32
00:02:03,870 --> 00:02:05,260
just clicking on this.

33
00:02:05,310 --> 00:02:11,070
I can hear height and here I can select this fluting action button and then press on until key on my

34
00:02:11,070 --> 00:02:13,160
keyboard so it is deleted right.

35
00:02:13,300 --> 00:02:15,370
So let's go to.

36
00:02:15,720 --> 00:02:18,510
Let me actually show you the menu.

37
00:02:18,510 --> 00:02:24,470
So here inside this android view inside this folder we have this menu folder right.

38
00:02:24,480 --> 00:02:26,660
If I open it here you can see this menu.

39
00:02:26,890 --> 00:02:34,140
Underline minute exam in this example file is added to our project because we use the basic activity

40
00:02:34,480 --> 00:02:35,030
right.

41
00:02:35,040 --> 00:02:39,380
So if I double click on it here you can see the spaded basic activity here.

42
00:02:39,390 --> 00:02:48,300
So now let's switch to text tab here and now we can see that we have a menu and we have an item inside

43
00:02:48,300 --> 00:02:49,130
this menu.

44
00:02:49,140 --> 00:02:50,940
So this item is sitting right.

45
00:02:50,940 --> 00:02:52,140
If I show you the emulator.

46
00:02:52,150 --> 00:02:55,950
Now here you can see that if I click on this menu here you can see this option here.

47
00:02:55,960 --> 00:03:02,510
The item settings so we don't we don't want to use this item here inside our absolute's actually selected

48
00:03:02,630 --> 00:03:03,000
here.

49
00:03:03,030 --> 00:03:05,540
This item and the person behind your keyboard.

50
00:03:05,940 --> 00:03:10,680
Now let's double click on this tab here menu under the name and examine in order to make this about

51
00:03:10,680 --> 00:03:11,620
you there.

52
00:03:11,760 --> 00:03:16,480
So let's specify the items that we want to use inside our application.

53
00:03:16,590 --> 00:03:21,900
So the first item that we want to add to this menu is going to be a martial art item.

54
00:03:21,900 --> 00:03:30,170
So let's open attack here and just select item and now the first one is going to be the first actually

55
00:03:30,560 --> 00:03:36,080
attributes of this item is going to be the ID of this item so that we can actually leave first to the

56
00:03:36,200 --> 00:03:41,930
item from our main activity class from our job of so and do it call an ID.

57
00:03:42,200 --> 00:03:45,500
And here in say the coats choose this one as signed.

58
00:03:45,500 --> 00:03:47,190
Plus Id slash.

59
00:03:47,240 --> 00:03:56,340
And now we can specify the id the actual ID so the ID is going to be at underline martial art at Underland

60
00:03:56,370 --> 00:03:58,360
Marshall on the line art.

61
00:03:58,520 --> 00:04:00,750
So this is going to be the ID right.

62
00:04:00,830 --> 00:04:03,230
And here lets specify the text.

63
00:04:03,260 --> 00:04:05,010
The title of this item.

64
00:04:05,080 --> 00:04:08,420
So just type in here title and then select title here.

65
00:04:08,690 --> 00:04:15,340
So for the title just typing here at martial art the final attribute that you want to specify for the

66
00:04:15,430 --> 00:04:18,680
item is actually show as action.

67
00:04:18,800 --> 00:04:20,470
So we have some options here.

68
00:04:20,510 --> 00:04:24,540
If room always collapse action view never to be text.

69
00:04:24,710 --> 00:04:26,970
So what does this means that mean.

70
00:04:27,030 --> 00:04:28,540
Surely the issue here.

71
00:04:28,720 --> 00:04:29,970
What does this mean.

72
00:04:29,980 --> 00:04:37,250
So by the way if you can't see the autocomplete feature here these options in order to actually open

73
00:04:37,250 --> 00:04:40,230
these auto companies are here.

74
00:04:40,340 --> 00:04:45,090
You can hold down the control on your keyboard and then person space on your keyboard.

75
00:04:45,440 --> 00:04:46,980
So the first one is if.

76
00:04:47,220 --> 00:04:53,600
If that means that if there is enough space in sight on Apple layout it's going to show this item in

77
00:04:53,600 --> 00:04:54,260
sight.

78
00:04:54,290 --> 00:05:01,570
Apple layout always means that it's going to always actually show this item inside or the app or layout

79
00:05:02,150 --> 00:05:03,030
but again it's going to.

80
00:05:03,050 --> 00:05:10,280
It depends on the space that actually is on inside our upper left and we have this never never means

81
00:05:10,520 --> 00:05:17,840
that it's not going to never actually to show despite it inside an apple layout because we have actually.

82
00:05:17,840 --> 00:05:20,030
This Let me show you this ellipsis here.

83
00:05:20,090 --> 00:05:21,630
We have these free dots here.

84
00:05:21,680 --> 00:05:28,850
If I click on it here now it's going to show us this button in these settings item right so never means

85
00:05:28,850 --> 00:05:29,600
that.

86
00:05:29,600 --> 00:05:31,920
So let's choose Ephraim.

87
00:05:32,240 --> 00:05:39,320
OK now let's self close this item by just putting a slash and the ending tag here right.

88
00:05:39,350 --> 00:05:43,550
So this is our first item so let's add another item here.

89
00:05:43,580 --> 00:05:50,270
So that's open attack item and here we need to specify first the actually the ID switch statement here

90
00:05:50,300 --> 00:05:53,320
ID as science plus the slash.

91
00:05:53,450 --> 00:05:58,910
So the second item is going to be delete item delete actually Marshall that sort of statement here deletes

92
00:05:59,960 --> 00:06:06,090
underline martial art right and then create an inline here.

93
00:06:06,120 --> 00:06:14,640
So let's specify the title so the title is going to be delete the martial art and the final attribute

94
00:06:14,640 --> 00:06:21,090
is going to be the show as action again if you let yourself close this item here and then let's add

95
00:06:21,090 --> 00:06:23,540
another item so item.

96
00:06:23,550 --> 00:06:29,730
So the first attribute is going to be the ID and add site plus ID slash.

97
00:06:29,900 --> 00:06:33,910
And it is going to be up date underline martial art.

98
00:06:33,920 --> 00:06:38,740
So this is the ID and the title is going to be the update martial art.

99
00:06:38,810 --> 00:06:40,810
And here we have these.

100
00:06:41,000 --> 00:06:44,940
So let's actually change the title to update the martial arts.

101
00:06:44,960 --> 00:06:51,860
So now for the show as action attribute to step in here if room and let yourself close this item here

102
00:06:51,860 --> 00:06:54,160
by just putting slash and the closing tag.

103
00:06:54,320 --> 00:06:57,350
So for now these are free items in are enough.

104
00:06:57,350 --> 00:07:00,200
Let's run the application and lets see if this works or not.

105
00:07:00,200 --> 00:07:05,360
So now here we can see that we have an error and the error is because of the floating action button

106
00:07:05,360 --> 00:07:08,770
that we actually deleted inside our activity under the limited example.

107
00:07:08,870 --> 00:07:13,550
But inside our main activity class and inside these uncreate by faith we have these we have this block

108
00:07:13,550 --> 00:07:17,100
of code that is related to deflect from actually floating action button.

109
00:07:17,180 --> 00:07:21,630
So lets selectees these lines of Cahir and then personally the key on your keyboard.

110
00:07:21,650 --> 00:07:24,640
Let's run the app now let's choose one of these devices.

111
00:07:24,650 --> 00:07:26,610
So again it says that we have an error.

112
00:07:26,750 --> 00:07:32,570
So here the error is because of this method insert inside our main activity class here.

113
00:07:32,690 --> 00:07:38,480
If you remember inside our menu that meant menu that means that the Excel file be deleted the action

114
00:07:38,480 --> 00:07:39,900
settings item right.

115
00:07:39,950 --> 00:07:44,630
So here inside our main activity class inside is an option item selected Mefford.

116
00:07:44,660 --> 00:07:48,320
Here it is referring to that ID which doesn't exist anymore.

117
00:07:48,320 --> 00:07:51,770
So we need to actually also delete this piece of code.

118
00:07:51,800 --> 00:07:53,950
So now let's run the app again.

119
00:07:53,990 --> 00:07:57,820
Let me show you the emulator and now it works perfectly.

120
00:07:57,980 --> 00:08:03,420
So here you can see that there is actually enough space for this at Martial Art menu idea.

121
00:08:03,440 --> 00:08:05,060
Only for this taste right.

122
00:08:05,330 --> 00:08:11,780
But if you want to just see the other options you need to click on this dropdown menu here and you can

123
00:08:11,780 --> 00:08:13,210
see these other options.

124
00:08:13,220 --> 00:08:16,670
So you can see that we have actually a typo.

125
00:08:16,670 --> 00:08:19,670
Let's go to menu that magnetic Metafile.

126
00:08:19,700 --> 00:08:22,790
So let me add here let me run the app again.

127
00:08:22,820 --> 00:08:26,380
So here at Marshall let's open this dropdown here.

128
00:08:26,480 --> 00:08:30,720
Click on it so you can see that it's most martial art and updates the martial arts.

129
00:08:30,950 --> 00:08:32,660
So these are the other items.

130
00:08:32,870 --> 00:08:38,090
So now that we have these items we need to actually create some activities for these items.

131
00:08:38,090 --> 00:08:44,360
For example I want to create an activity for this at Martial Art item so that the user can create a

132
00:08:44,360 --> 00:08:51,650
martial art and add that martial art object to the light so that we can have that and we can actually

133
00:08:51,650 --> 00:08:56,930
save that that object to Escuela and we can later retrieved that object we can.

134
00:08:56,940 --> 00:09:03,450
We need to also create an activity for that deletes the martial art item and update the martial arts.

135
00:09:03,470 --> 00:09:09,800
So let's go to Andrew to you first class the first activity that we want to create is going to be at

136
00:09:10,110 --> 00:09:10,970
a martial arts.

137
00:09:11,150 --> 00:09:16,970
So let's open our view here let's open the adult view if you want to we can just click on view at the

138
00:09:16,970 --> 00:09:19,520
top tool windows and then click on Project.

139
00:09:19,520 --> 00:09:25,280
So now let's open the is a Java folder the first package is this package right.

140
00:09:25,490 --> 00:09:27,970
Let's open it here.

141
00:09:28,040 --> 00:09:35,030
Now I want to create another activity right click on this package new all you want to create an activity

142
00:09:35,030 --> 00:09:35,940
not a class.

143
00:09:35,960 --> 00:09:36,890
Right.

144
00:09:36,890 --> 00:09:42,570
So let's actually go to the activity here activity option and here you can see these options here right.

145
00:09:42,740 --> 00:09:45,470
Let's select this one empty activity.

146
00:09:45,470 --> 00:09:46,040
OK.

147
00:09:46,220 --> 00:09:47,640
Empty activity.

148
00:09:47,720 --> 00:09:54,350
So first it's going to ask us to specify the activity name the activity name is going to be at martial

149
00:09:54,360 --> 00:09:57,400
art at martial arts activity.

150
00:09:57,470 --> 00:10:01,670
So here the lay name is going to be activity on the island at Underland martial art.

151
00:10:01,700 --> 00:10:02,760
Right.

152
00:10:02,810 --> 00:10:08,550
So it's as if you you want this activity to be the to activity no I don't want this activity to be a

153
00:10:08,590 --> 00:10:14,190
lot of activity because the main activity class is actually the lunch activity.

154
00:10:14,300 --> 00:10:19,350
So I don't want this activity to be the luncher and it's ass backwards compatibility at.

155
00:10:19,370 --> 00:10:19,940
Yes.

156
00:10:19,940 --> 00:10:24,480
Make sure to check this checkbox so that we have backwards compatibility.

157
00:10:24,740 --> 00:10:30,140
Make sure that you can specify the package name but I don't recommend to actually change its package

158
00:10:30,140 --> 00:10:36,410
name because you want this activity to be in the same package that this main activity actually exists.

159
00:10:36,410 --> 00:10:38,300
So let's click on finish.

160
00:10:38,450 --> 00:10:43,890
So now the activity is created at martial arts activity extends of combat activity.

161
00:10:43,920 --> 00:10:47,920
We have this uncreate Meffert or write it for us automatically by Android studio.

162
00:10:47,990 --> 00:10:53,960
And it's a set content if you order to lay out that activity Underland martial arts so you can see that

163
00:10:54,350 --> 00:10:58,490
it also created an XML file for our layout.

164
00:10:58,520 --> 00:11:04,370
If I actually open this last folder here inside this last folder we have this activity Underland at

165
00:11:04,370 --> 00:11:06,040
Underland martial artist example.

166
00:11:06,320 --> 00:11:06,850
Right.

167
00:11:07,130 --> 00:11:09,460
And inside this let's go to them manifest.

168
00:11:09,460 --> 00:11:09,960
Why.

169
00:11:10,040 --> 00:11:12,670
Let's actually double click on it manifests year.

170
00:11:12,830 --> 00:11:22,150
You can see that it also created a new tag for our martial art activity class here in this application.

171
00:11:22,520 --> 00:11:26,690
So let's go back to our martial art activity here.

172
00:11:27,020 --> 00:11:31,610
Let's double click on this tab in order to make this area higher inside this uncreate Smurfette.

173
00:11:31,610 --> 00:11:33,890
Let's create a toast message here.

174
00:11:33,890 --> 00:11:38,260
Toast that make text to make text.

175
00:11:38,270 --> 00:11:43,910
So first we need to specify the context which is going to be the main activity that does come up and

176
00:11:43,910 --> 00:11:45,780
then the text is going to be.

177
00:11:46,070 --> 00:11:54,290
This is martial art activity karma and then the lenth is going to be short that show.

178
00:11:54,410 --> 00:11:55,020
Right.

179
00:11:55,310 --> 00:11:59,630
So here you can see that I passed the wrong context.

180
00:11:59,630 --> 00:12:00,720
Why.

181
00:12:00,740 --> 00:12:05,320
Because the context is at martial art activity not main activity.

182
00:12:05,360 --> 00:12:07,820
Here we are inside this at martial art activity.

183
00:12:07,820 --> 00:12:11,090
So the context it is actually at Martial activity.

184
00:12:11,210 --> 00:12:13,240
We are not inside the mind of the class.

185
00:12:13,400 --> 00:12:15,560
So this is the wrong context.

186
00:12:15,560 --> 00:12:18,470
So let's change it to add martial arts activity.

187
00:12:18,470 --> 00:12:24,560
This is the right context at much of the activity that this so why I say Atmar activity that these this

188
00:12:24,740 --> 00:12:31,590
refers to an instance of type at Martial activity when we run the application on an on an emulator.

189
00:12:31,850 --> 00:12:37,500
And when we want to for example Srishti this activity an instance of this activity is going to be created.

190
00:12:37,610 --> 00:12:42,480
So we need to revert to an instance of type at Marshal activity as a context here.

191
00:12:42,590 --> 00:12:48,610
So now it's time to go to the main activity class here and you can see that we have this main activity

192
00:12:48,620 --> 00:12:50,460
class this is our uncreate Mefford.

193
00:12:50,630 --> 00:12:57,260
And here we have this uncreate options menu here the Spirit is going to be called when the menu is going

194
00:12:57,260 --> 00:13:00,180
to be inflated on or actually Apple lay out.

195
00:13:00,350 --> 00:13:05,730
So it says just menu inflator that inflate our menu that menu that the underline may.

196
00:13:05,810 --> 00:13:08,910
So it is going to it is actually referring to our menu on it.

197
00:13:08,910 --> 00:13:15,820
I mean it is a small file and it is passing this menu argument here to this inflates Mefford.

198
00:13:16,040 --> 00:13:21,420
So it is going to specify this menu mean the same as the menu inside our Apple layout.

199
00:13:21,440 --> 00:13:28,370
So if it is necessary if you want to have these actually menu capability this menu feature inside your

200
00:13:28,370 --> 00:13:32,970
app out and we have this on options I'll let them select that method.

201
00:13:33,140 --> 00:13:41,280
So this is going to be actually called Vendy user touches one of the items of insight on menu.

202
00:13:41,420 --> 00:13:42,390
Right.

203
00:13:42,470 --> 00:13:46,900
So we have this item as the argument which is off the menu item here.

204
00:13:46,910 --> 00:13:48,380
Right on option items selected.

205
00:13:48,380 --> 00:13:54,890
So let's look at these comments it says handle action by item clicks here the action bar will automatically

206
00:13:54,890 --> 00:13:58,420
handle clicks on the home or up but up button.

207
00:13:58,520 --> 00:14:03,030
So long as you specify a parent activity and it manifests that Semmel.

208
00:14:03,470 --> 00:14:05,270
So let's delete these comments.

209
00:14:05,270 --> 00:14:09,380
We don't want to actually we don't want them to be here.

210
00:14:09,440 --> 00:14:12,370
Now we have only this these two lines of code here.

211
00:14:12,380 --> 00:14:17,020
The first one is and the idea that get ID.

212
00:14:17,300 --> 00:14:21,480
So it is getting the ID of a specific ID and insight on many.

213
00:14:21,480 --> 00:14:25,880
Let me show you the emulator so you can see that we have these items here right.

214
00:14:26,270 --> 00:14:29,980
So the first one at March were not he is actually an item.

215
00:14:30,340 --> 00:14:36,250
So Id them that get ID and ID is going to give us the ID of this item.

216
00:14:36,560 --> 00:14:40,280
And its going to assign ID to this body but because of that integer.

217
00:14:40,310 --> 00:14:42,000
Now we have this idea right.

218
00:14:42,200 --> 00:14:48,140
So if we can create a switch statement so lets look at this line of code here we can see that the return

219
00:14:48,140 --> 00:14:53,720
type of this method is of a bully and so we must return a value of a boolean from the it.

220
00:14:53,730 --> 00:14:57,280
So it is the return super that unofficial item selected item.

221
00:14:57,400 --> 00:15:05,170
So it is actually returning the return value of the Smurfette and the superclass.

222
00:15:05,350 --> 00:15:07,680
So the superclass of this main activity class.

223
00:15:07,840 --> 00:15:11,330
So this method calling here is going to do nothing.

224
00:15:11,440 --> 00:15:15,770
And that's why it is called here because it must retain the value of A.

225
00:15:16,000 --> 00:15:17,400
And it is passing the item here.

226
00:15:17,530 --> 00:15:25,510
So now let's after this none of what I'm going to actually just switch over to switch between the values

227
00:15:25,540 --> 00:15:34,500
of the ID valuable right and I can say Chase are thought Id dot at martial arts.

228
00:15:34,680 --> 00:15:36,620
Id call in.

229
00:15:36,730 --> 00:15:37,510
So what does this mean.

230
00:15:37,510 --> 00:15:44,780
This means that if the value of this ID value bet is actually at Martial Art ID here.

231
00:15:44,830 --> 00:15:52,290
So I am saying that if the user actually clicked or touched this item at martial art then I can say.

232
00:15:52,690 --> 00:16:01,150
So lets create an intent here intent and here I can say at Martial Art intent at Martial Art intent

233
00:16:02,200 --> 00:16:11,470
assignment operator new intent and now of this intent actually class has a constructor that accepts

234
00:16:11,470 --> 00:16:16,390
two arguments the first argument is going to be the context which is going to be main activity that

235
00:16:16,530 --> 00:16:18,590
does come up.

236
00:16:18,850 --> 00:16:22,760
The second argument is going to be the class that we want to transition to.

237
00:16:23,020 --> 00:16:29,130
So the second class is going to be a martial art activity at martial arts activity.

238
00:16:29,670 --> 00:16:34,000
That class this is really important that class semicolon.

239
00:16:34,210 --> 00:16:38,820
So let me create a new line here so that you can see this entire line of code here.

240
00:16:38,950 --> 00:16:45,860
Now I can see start activity and I just need to pass this outmuscled intent here.

241
00:16:46,650 --> 00:16:47,870
That's it.

242
00:16:47,880 --> 00:16:53,100
So after this case statement I'm going to say return true.

243
00:16:53,100 --> 00:16:58,310
So what is this return to roominess this retention means that do not execute any other codes after this

244
00:16:58,310 --> 00:17:04,950
case a statement if this case is true do not execute any other courts after this is Chasez statement

245
00:17:04,980 --> 00:17:07,200
because this is actually the case.

246
00:17:07,200 --> 00:17:12,510
True and I want to transition to another instance so it is not necessary to execute any other courts

247
00:17:12,570 --> 00:17:14,760
after this case statement.

248
00:17:14,880 --> 00:17:20,200
So return means actually it is a little bit like a plage statement here.

249
00:17:20,550 --> 00:17:24,290
Let's run the app and let's see if anything works fine or not.

250
00:17:24,300 --> 00:17:29,210
Let me show you the emulator so now the application is running on this emulator.

251
00:17:29,210 --> 00:17:32,900
Here let's click on at martial arts.

252
00:17:32,920 --> 00:17:39,540
Now you can see that we transitioned to this activity and you saw this TOSed message here.

253
00:17:39,580 --> 00:17:42,410
So let's go to our studio and let's go to.

254
00:17:42,770 --> 00:17:47,970
Actually the content underlayment and and here let's select this hello world takes you and then personality

255
00:17:48,030 --> 00:17:49,000
on our keyboard.

256
00:17:49,330 --> 00:17:50,260
We don't want that here.

