1
00:00:00,240 --> 00:00:06,190
High students in this theater early on we're going to go ahead and create another Android application.

2
00:00:06,270 --> 00:00:11,360
And here we just need to click on Start in your Android studio project and for the application name

3
00:00:11,370 --> 00:00:15,810
just say in here app 70 and then click on next.

4
00:00:16,050 --> 00:00:22,810
And here you can actually specify the minimum SDK so choose AP A16 Android 4.1.

5
00:00:23,100 --> 00:00:26,920
And then click on next and he'll choose any activity next.

6
00:00:27,120 --> 00:00:28,950
And here just click on finish.

7
00:00:29,340 --> 00:00:33,980
So here we just need to actually connect our Android application to Firebrace.

8
00:00:34,110 --> 00:00:39,030
So at the top just click on Tools and then click on firebase And here is going to actually open the

9
00:00:39,030 --> 00:00:40,770
firebase assistant for us.

10
00:00:40,770 --> 00:00:45,710
So here just click on real time database and then click on Save and retrieve data.

11
00:00:45,870 --> 00:00:48,770
So first we need to connect our application to firebase.

12
00:00:48,780 --> 00:00:50,720
So just click on button.

13
00:00:50,720 --> 00:00:55,290
Just click on the spot and connect to firebase And then here you want to actually again connect our

14
00:00:55,290 --> 00:01:00,180
application to apps sixty five that we actually already created in firebase.

15
00:01:00,180 --> 00:01:06,180
So just take these radio about and choose an existing firebase or Google project and then select 65

16
00:01:06,240 --> 00:01:08,120
and then click on Connect to firebase.

17
00:01:08,250 --> 00:01:13,560
And now that our Android application is actually connected to firebase when you actually click on the

18
00:01:13,560 --> 00:01:16,450
spot in real time database your app.

19
00:01:16,470 --> 00:01:20,000
So just click on the spot in and then click on accept the changes.

20
00:01:20,040 --> 00:01:28,290
And now that everything is ready now we can actually just go to activity on the minute example here.

21
00:01:28,290 --> 00:01:31,530
So now let me actually collapsed this assistance earlier.

22
00:01:32,070 --> 00:01:34,640
So here is just the selectees hello world view.

23
00:01:34,800 --> 00:01:36,920
And then a person delete key on your keyboard.

24
00:01:37,080 --> 00:01:41,270
So now I want to actually change this relatively out to our linear layout.

25
00:01:41,310 --> 00:01:47,980
So at the bottom just click on text tab here and change this real relatively else to linearly out.

26
00:01:48,120 --> 00:01:54,510
And now we need to specify the orientation of our linear left so just type in here orientation and then

27
00:01:54,510 --> 00:01:58,130
choose vertical and then we can at the top here at the bottom.

28
00:01:58,260 --> 00:02:02,260
So I will try to derive a list view into this linearly Ellsworthy code.

29
00:02:02,310 --> 00:02:08,070
So let's scroll down here inside this palette section and inside the containers fall there so that I

30
00:02:08,070 --> 00:02:10,420
actually find the containers folder.

31
00:02:10,440 --> 00:02:14,420
So here is the containers folder and choose at least view here.

32
00:02:14,520 --> 00:02:20,490
Just drag it here into this linearly outerwear call and select the list view and for the ID just type

33
00:02:20,490 --> 00:02:24,390
in a list view and then person enter key on your keyboard.

34
00:02:24,660 --> 00:02:32,210
So now I want to add the firebase database you are or you want to add that dependency to my applicable

35
00:02:32,450 --> 00:02:35,740
app level project app level builder.

36
00:02:35,760 --> 00:02:36,120
Great.

37
00:02:36,150 --> 00:02:38,600
So we have the speed that cradle your app.

38
00:02:38,670 --> 00:02:40,330
So just double click on this one here.

39
00:02:40,350 --> 00:02:45,180
So just open cradle scripts and just double click and this build that great module app.

40
00:02:45,180 --> 00:02:47,590
This is actually the applet will be that cradle.

41
00:02:47,640 --> 00:02:49,950
So inside is the dependences block.

42
00:02:49,950 --> 00:02:53,820
We can actually put our dependency here firebase database.

43
00:02:53,880 --> 00:02:55,850
So let's actually open our Web browser.

44
00:02:55,920 --> 00:03:02,800
So I actually entered this you are here to get hot dot com slash firebase slash firebase you are Android.

45
00:03:02,970 --> 00:03:04,430
So here let's scroll down here.

46
00:03:04,440 --> 00:03:06,460
As you can see it says installation.

47
00:03:06,480 --> 00:03:08,290
So just copy this code here.

48
00:03:08,310 --> 00:03:14,980
It says firebase a database only just copy just select it and right click on it and then click on copy.

49
00:03:15,120 --> 00:03:19,720
So let's go back to android studio and here you can actually the inside is our dependencies plug.

50
00:03:19,800 --> 00:03:23,380
You can paste this code at the top just click on the screen now.

51
00:03:23,400 --> 00:03:29,740
So now that our project is actually synched we can use these firebase UI database.

52
00:03:29,760 --> 00:03:33,380
So now let's actually go to main activity that have a file.

53
00:03:33,400 --> 00:03:36,860
Let's actually double click on this tab here in order to make this area wider.

54
00:03:36,930 --> 00:03:41,640
And inside this main activity class I'm going to paste in some lines of code and then I'm going to explain

55
00:03:41,640 --> 00:03:43,050
to you what's going on here.

56
00:03:43,050 --> 00:03:47,490
So as you can see here these are the lines of code that I pasted here.

57
00:03:47,640 --> 00:03:53,820
So in line number 14 we have this variable which I actually declared here and I didn't initialized yet.

58
00:03:54,000 --> 00:03:59,100
So as you can see the data type of this valuable is List view and the name of this variable is list

59
00:03:59,100 --> 00:03:59,550
view.

60
00:03:59,820 --> 00:04:03,530
And here in line number 15 we have actually a database reference.

61
00:04:03,630 --> 00:04:07,720
So the name of this variable is database reference in line number 17.

62
00:04:07,740 --> 00:04:09,970
We have a firebase list adapter.

63
00:04:10,050 --> 00:04:16,320
So notice that you are using firebase list adapter not firebase recycle adapter here because we want

64
00:04:16,320 --> 00:04:17,580
to use the list view.

65
00:04:17,670 --> 00:04:23,220
We should actually use the firebase said after an inside the angle brackets we just need to pass the

66
00:04:23,340 --> 00:04:25,440
data type of the model objects.

67
00:04:25,440 --> 00:04:28,470
So if you want to get Buxar objects from the server.

68
00:04:28,470 --> 00:04:29,130
Right.

69
00:04:29,130 --> 00:04:31,090
So now let me show you the web browser here.

70
00:04:31,200 --> 00:04:36,960
So let's go to firebase and here at the top I just click on go to console and you know that we actually

71
00:04:36,960 --> 00:04:40,290
connected our application to 65 firebase project.

72
00:04:40,290 --> 00:04:45,370
So just click on it selected and then click on database.

73
00:04:45,380 --> 00:04:50,840
So now are we need to actually refresh this page so just click on to start here and then click on data

74
00:04:51,130 --> 00:04:53,690
and that is going to actually show us the box that objects.

75
00:04:53,700 --> 00:04:56,370
So as you can see here we have these boxes objects.

76
00:04:56,390 --> 00:05:01,880
So now in this tutorial I want to let you know how we can actually delete your objects how we can delete

77
00:05:01,880 --> 00:05:03,600
notes in Firebrace.

78
00:05:03,620 --> 00:05:09,920
So now as you can see the bug so here is in red and this means that we don't have the Buxar class.

79
00:05:09,920 --> 00:05:14,310
So now at the top just click on the View tool windows and then click on Project.

80
00:05:14,310 --> 00:05:20,600
And now inside this app for lead and inside the Java folder inside this package just select this packet

81
00:05:20,630 --> 00:05:25,940
and then click on file at the top new and then click on Java class and for the name just type in your

82
00:05:25,940 --> 00:05:28,980
box with a capital B and then click on OK.

83
00:05:29,360 --> 00:05:35,140
So now we have this box of class so let's actually create some instance variables here.

84
00:05:35,150 --> 00:05:39,140
So now let me show you the web browser as you can see here we have Buxar name punch power and punch

85
00:05:39,140 --> 00:05:39,820
speed.

86
00:05:39,830 --> 00:05:44,340
So these are the instance variables are our box object.

87
00:05:44,360 --> 00:05:47,780
So let me try the double click on the stop here in order to make this area wider.

88
00:05:47,960 --> 00:05:56,810
And here I can say are private's excuse me private strange Boxer name.

89
00:05:56,960 --> 00:06:02,810
And notice that the name of your valuable the name of your instance variables must be the same as the

90
00:06:02,810 --> 00:06:04,650
name of your variable here.

91
00:06:04,700 --> 00:06:05,140
Right.

92
00:06:05,300 --> 00:06:07,190
As the name of this key box only.

93
00:06:07,520 --> 00:06:10,470
So let's actually declare another ridable.

94
00:06:10,580 --> 00:06:22,110
So private int punch power private punch power private int punch Spaeth semicolon.

95
00:06:22,280 --> 00:06:25,190
So now let's actually create an empty constructor.

96
00:06:25,190 --> 00:06:31,430
So here I can say public a boxer and then I need to put a pair of pants here and then I just need to

97
00:06:31,430 --> 00:06:33,420
open and close this empty constructor.

98
00:06:33,570 --> 00:06:37,390
Using these curly braces and often an incredible brace followed by a closing curly brace.

99
00:06:37,400 --> 00:06:43,840
So now we need to create another constructor in order to initialize our instance variables event in

100
00:06:44,000 --> 00:06:48,980
the program or developer wants to actually initialize these instance variables.

101
00:06:49,100 --> 00:06:54,830
So we put this empty constructor here because it is necessary because we want to interact with the firebase

102
00:06:54,830 --> 00:06:55,560
database.

103
00:06:55,730 --> 00:06:57,920
So let's create another constructor.

104
00:06:57,920 --> 00:07:03,620
So inside this class just right click here and then click on generate and then click on constructor

105
00:07:04,010 --> 00:07:07,460
and then select all these instance variables and then click on OK.

106
00:07:07,700 --> 00:07:10,070
So here we have this constructor as you can see here.

107
00:07:10,160 --> 00:07:14,080
So here we are actually initializing our instance variables.

108
00:07:14,090 --> 00:07:19,310
So now this actually creates some getters for these instance variables so here inside this class I can

109
00:07:19,310 --> 00:07:20,240
write code here.

110
00:07:20,240 --> 00:07:26,330
I can just click on generate and then I can click on get here and then here I can select all these instance

111
00:07:26,330 --> 00:07:28,600
variables and then here I can click on OK.

112
00:07:28,700 --> 00:07:32,490
So here we have these get help for our instance variables right.

113
00:07:32,510 --> 00:07:37,640
So let's go to our main activity class and now as you can see here we have this box class yet right.

114
00:07:37,640 --> 00:07:46,640
So now let's actually go into our uncreate method and here let's initialize our For example our valuable

115
00:07:46,640 --> 00:07:49,120
is that we declared inside our main activity class.

116
00:07:49,250 --> 00:07:54,200
So the first variable is actually assignment operator and then here I need to cast this object to this

117
00:07:54,320 --> 00:08:01,440
view object find view by ID or the ID thought list view right list view semicolon.

118
00:08:01,520 --> 00:08:05,780
So here I want to paste some lines of code inside this uncreate method and then I'm going to explain

119
00:08:05,780 --> 00:08:07,590
to you what's going on here.

120
00:08:07,640 --> 00:08:12,650
So as you can see these are the lines of code that I pasted here inline number 32 as you can see I am

121
00:08:12,700 --> 00:08:18,110
truly enabling the fire of the offline capability of firebase so firebase database that get instance

122
00:08:18,380 --> 00:08:20,020
that said persistence enabled.

123
00:08:20,060 --> 00:08:24,130
So you are already familiar with this code and in line number 44.

124
00:08:24,170 --> 00:08:31,520
I am actually creating an instance of type or firebase so firebase a database a database assignment

125
00:08:31,520 --> 00:08:36,170
operator firebase database that get instance right and an inline number 55.

126
00:08:36,170 --> 00:08:42,450
I am initializing this database reference so database reference assignment operator database that gets

127
00:08:42,450 --> 00:08:44,110
reference right.

128
00:08:44,120 --> 00:08:49,490
And here again because we want to enable the the offline capability of firebase we need to put this

129
00:08:49,500 --> 00:08:52,600
code here database for friends that keep seeing the truth.

130
00:08:53,000 --> 00:08:57,250
So now so now let me show you the web browser here.

131
00:08:57,650 --> 00:09:04,790
As you can see here I have these boxes objects here right for example Avon a zero a 1 and 2 and these

132
00:09:04,910 --> 00:09:05,870
other objects.

133
00:09:05,870 --> 00:09:09,010
Now you may want to actually delete all these objects right.

134
00:09:09,020 --> 00:09:13,160
So let's go to Andrew would you and I can say database reference.

135
00:09:13,160 --> 00:09:13,700
Right.

136
00:09:13,740 --> 00:09:21,220
They have a different Stut said excuse me remove value set semi-colon.

137
00:09:21,230 --> 00:09:25,250
So in this way we actually we have a reference to our north right.

138
00:09:25,250 --> 00:09:25,940
This is our north.

139
00:09:25,940 --> 00:09:28,320
This is our database instance.

140
00:09:28,400 --> 00:09:34,700
And then I say database reference that remove value is going to actually move all these children of

141
00:09:34,700 --> 00:09:40,200
this database instance it's going to remove the values of this database instance.

142
00:09:40,220 --> 00:09:43,070
So here we are saying database inference that to remove value.

143
00:09:43,310 --> 00:09:50,760
So it's actually not our project now and then click here choose up connected device of our device or

144
00:09:50,760 --> 00:09:53,280
maybe a real device and then click on OK.

145
00:09:53,520 --> 00:09:57,870
So now let me show you that browser here and now we can actually delete all these objects.

146
00:09:57,870 --> 00:09:59,310
So let's make a little bit here.

147
00:10:00,540 --> 00:10:04,770
So now as you can see here all these data now are deleted.

148
00:10:04,950 --> 00:10:05,250
Right.

149
00:10:05,250 --> 00:10:09,340
All the children of this north of this instance are now deleted.

150
00:10:09,360 --> 00:10:09,930
Why.

151
00:10:09,930 --> 00:10:13,950
Because we put this code here a database of friends that remove value.

152
00:10:14,070 --> 00:10:21,570
So by using this code you can actually move your your children in firebase right your database of children

153
00:10:21,660 --> 00:10:23,690
your notes in firebase.

154
00:10:23,760 --> 00:10:30,270
So now I'm going to actually just comment out this line of got here and now let me show you the web

155
00:10:30,270 --> 00:10:31,410
browser as you can see here.

156
00:10:31,530 --> 00:10:33,670
We have no children here right.

157
00:10:33,730 --> 00:10:35,570
This note doesn't have any children.

158
00:10:35,610 --> 00:10:40,500
So now I want to I want you to send some children some box of objects to the server.

159
00:10:40,500 --> 00:10:44,620
So in order to do that I can't just create a for loop and here I can say it.

160
00:10:44,840 --> 00:10:45,690
All right.

161
00:10:45,690 --> 00:10:46,800
Assignment operator zero.

162
00:10:46,800 --> 00:10:53,010
So this is going to be the initial value and now I need to actually specify the condition in which determines

163
00:10:53,040 --> 00:10:56,000
how many times this fall is going to be executed.

164
00:10:56,100 --> 00:11:02,130
So this fall of here is going to be executed until the value of this is less than for example for the

165
00:11:02,400 --> 00:11:03,580
right semicolon.

166
00:11:03,840 --> 00:11:09,720
And then here I can say that this Fall of year after each execution of this Fall of the value of this

167
00:11:09,730 --> 00:11:14,580
idea is going to be incremented by 1 and then I can just open and close this for loop by using these

168
00:11:14,580 --> 00:11:19,500
curly braces and opening curly brace for the closing curly brace and then here I can literally create

169
00:11:19,560 --> 00:11:20,860
a boxer object.

170
00:11:20,880 --> 00:11:24,520
So Boxer Boxer assignment operator new boxer.

171
00:11:24,540 --> 00:11:27,620
So here I am actually creating a new boxer instance.

172
00:11:27,810 --> 00:11:30,470
And here for the name I can say for example a.

173
00:11:30,880 --> 00:11:31,530
Right.

174
00:11:31,560 --> 00:11:39,100
Plus all the write as you can see for the name of our books that I am saying that a and for example

175
00:11:39,240 --> 00:11:44,760
for the first time that this fall here is going to be executed this initial value is actually playing

176
00:11:44,760 --> 00:11:47,530
the role of it actually the role of an index.

177
00:11:47,550 --> 00:11:48,240
Right.

178
00:11:48,270 --> 00:11:53,450
And here we are seeing a plus one for the first time that this year is going to be executed.

179
00:11:53,550 --> 00:11:55,060
The value of this is zero.

180
00:11:55,140 --> 00:12:01,500
So it's going I actually sent a box that objectivity a zero to the server and for the second time that

181
00:12:01,500 --> 00:12:02,900
this is going to be executed.

182
00:12:02,910 --> 00:12:06,920
Now the value of this is actually incremented by one.

183
00:12:06,930 --> 00:12:09,690
So now the value of this is actually D1 right.

184
00:12:09,720 --> 00:12:10,240
Right.

185
00:12:10,260 --> 00:12:17,900
So and then it's going to send a box that object to the server with the Buxar name of a one and so on.

186
00:12:17,920 --> 00:12:18,490
Right.

187
00:12:18,540 --> 00:12:23,640
So this is our first argument which is actually going to specify the name of our boxer and then we need

188
00:12:23,640 --> 00:12:30,120
to specify the punch power of the punch power is for example one thousandth and the punch spit is 2000

189
00:12:30,550 --> 00:12:31,420
semicolon.

190
00:12:31,620 --> 00:12:34,990
So unable to actually send this back this box that object to the server.

191
00:12:35,010 --> 00:12:41,550
So here I can say database reference but child database reference.

192
00:12:41,550 --> 00:12:41,960
Right.

193
00:12:41,970 --> 00:12:49,630
So here I want to create a unique IDs for each box set objects so they have a reference that push dot

194
00:12:49,690 --> 00:12:50,260
get key.

195
00:12:50,370 --> 00:12:57,270
So when I say that push is going to actually create that specific unique ID for my specific box that

196
00:12:57,300 --> 00:12:58,070
objects.

197
00:12:58,170 --> 00:13:02,050
So they have a fence that push that gate key that sets value.

198
00:13:02,040 --> 00:13:05,680
So now I can actually send my box of objects to those IDs.

199
00:13:05,730 --> 00:13:09,550
So set value Buxar semicolon.

200
00:13:09,690 --> 00:13:11,910
So now we have this for loop right.

201
00:13:11,940 --> 00:13:17,760
So it's going to actually create a box of objects here and it's going to actually send those boxes objects

202
00:13:17,790 --> 00:13:18,680
to the server.

203
00:13:18,690 --> 00:13:21,230
So let's wrap our project now.

204
00:13:21,240 --> 00:13:26,170
Now let me show you the web browser and here it is our Actually emulator.

205
00:13:26,190 --> 00:13:30,900
So now you can see that the Buxar objects are actually sent to the server.

206
00:13:30,900 --> 00:13:31,660
Right.

207
00:13:31,740 --> 00:13:35,790
So we have 40 bucks that objects to the box a name is a zero.

208
00:13:35,850 --> 00:13:41,100
The first box that update is a one on the end as you can see here a 29.

209
00:13:41,190 --> 00:13:45,660
So because it actually starts with a zero it ends with 8:29 right.

210
00:13:45,660 --> 00:13:52,120
So let's go to our Android studio here and here I'm going to actually pasting some lines of code.

211
00:13:52,170 --> 00:13:57,640
So here inside this uncreate Smurfette I need to actually initialize our firebase least adapter.

212
00:13:57,780 --> 00:14:03,240
So as you can see here in line number 18 inside this main activity class we actually declared our valuable

213
00:14:03,240 --> 00:14:06,410
fire baseless adapter at inside our uncreate method.

214
00:14:06,420 --> 00:14:08,290
We need to initialize this value.

215
00:14:08,430 --> 00:14:14,190
So before the end in curly braces of this uncreate Mefford and insight this uncreate method I can just

216
00:14:14,270 --> 00:14:17,970
typing firebase list adapter assignment operator.

217
00:14:18,120 --> 00:14:22,740
And then here I can't just put the new keyboard and here I can hold the shift key on my keyboard and

218
00:14:22,740 --> 00:14:24,940
then press on the letter F G on my keyboard.

219
00:14:25,140 --> 00:14:27,420
So now I can actually select this option.

220
00:14:27,420 --> 00:14:33,570
So now as you can see here the autocomplete feature of Android studio is actually helping me to choose

221
00:14:33,570 --> 00:14:35,590
this option for your baseless adapter.

222
00:14:35,730 --> 00:14:38,250
So just select it and then press an interview on your keyboard.

223
00:14:38,250 --> 00:14:45,780
So now after the end in curly brace of this I actually firebase this adapter here only to put a semicolon

224
00:14:45,780 --> 00:14:46,450
here.

225
00:14:46,800 --> 00:14:50,090
And as you can see here we have this up a pair of practices.

226
00:14:50,220 --> 00:14:56,160
And if we actually hover over this error we need to actually it says that we need to provide some arguments.

227
00:14:56,160 --> 00:15:00,530
So the first argument is actually the activity the context.

228
00:15:00,540 --> 00:15:00,990
Right.

229
00:15:01,080 --> 00:15:06,700
So the first argument is the context which is going to be the main activity to this right.

230
00:15:06,810 --> 00:15:09,690
And the second argument is going to be the model class.

231
00:15:09,690 --> 00:15:15,030
So the model class is actually a box in the class because if you want to actually get the box set objects

232
00:15:15,060 --> 00:15:18,390
from December you also sent this box that objects to the set.

233
00:15:18,390 --> 00:15:18,550
Right.

234
00:15:18,540 --> 00:15:18,890
Right.

235
00:15:18,900 --> 00:15:24,900
So if you want to get these objects from the center and for the first argument as you can see here of

236
00:15:24,900 --> 00:15:31,920
I need to specify the layout of our items of item views and for the forth argument or final argument

237
00:15:32,190 --> 00:15:34,350
we need to specify the database reference.

238
00:15:34,380 --> 00:15:39,020
So first of all let's actually just put the first argument here.

239
00:15:39,030 --> 00:15:43,130
So the first argument is actually an activity that this comma.

240
00:15:43,440 --> 00:15:46,470
Now let me actually create a newline character here a new line.

241
00:15:46,650 --> 00:15:53,490
And for the second argument I need to specify the model class of boxers that class come.

242
00:15:53,700 --> 00:15:59,450
And for the first argument I need to specify the model lay out light of item or item views.

243
00:15:59,550 --> 00:16:12,420
So here I can say Android dot Android dot or dot lay out dot see me here are the mistake and we have

244
00:16:12,420 --> 00:16:16,180
a typo Android right Android that are that lay out.

245
00:16:16,680 --> 00:16:19,410
That's a two line list item.

246
00:16:19,410 --> 00:16:24,880
So if you have a simple list item one and we have to line list items which was this one instead and

247
00:16:24,870 --> 00:16:26,700
then person it on your keyboard.

248
00:16:26,700 --> 00:16:31,680
And for the final argument we need to actually pass the database reference here.

249
00:16:32,100 --> 00:16:33,500
So now we have no errors yet.

250
00:16:33,510 --> 00:16:33,960
Right.

251
00:16:34,140 --> 00:16:36,580
And here we have this populate new method.

252
00:16:36,600 --> 00:16:40,780
So let's go inside the populate view method now and here.

253
00:16:40,800 --> 00:16:44,230
First of all let me tell you that we have this for for loop here right.

254
00:16:44,370 --> 00:16:50,250
And the job of this for loop is actually to create Buxar objects fretty box that objects and to send

255
00:16:50,280 --> 00:16:51,590
these objects to the set up.

256
00:16:51,750 --> 00:16:52,990
And now let me show you the server.

257
00:16:53,010 --> 00:16:54,820
Let me show you the web browser as you can see here.

258
00:16:54,930 --> 00:16:57,820
So here we have 40 bucks that objects right.

259
00:16:57,920 --> 00:17:03,680
So whenever have run an Android application it's going to execute this for loop here for us.

260
00:17:03,690 --> 00:17:07,600
So it's going to actually send a 50 bucks that object through a server error free.

261
00:17:07,710 --> 00:17:10,680
Every time we actually do it on our Android application.

262
00:17:10,680 --> 00:17:17,000
So now I don't want to create a 50 box of objects every time that we have to run our Android application.

263
00:17:17,130 --> 00:17:20,220
So let's actually comment out this follow up here.

264
00:17:20,250 --> 00:17:23,900
So now let's actually go inside these populate view.

265
00:17:24,060 --> 00:17:30,240
So let's look at this to populate buma if we have this method method and this Linforth have has a free

266
00:17:30,240 --> 00:17:30,780
arguments.

267
00:17:30,780 --> 00:17:34,790
The first argument is actually offtake view and the name of this argument is weak.

268
00:17:34,800 --> 00:17:37,320
So this should change the name of these arguments to view.

269
00:17:37,470 --> 00:17:42,900
And the second argument is actually the model which is of a boxer and the first argument is going to

270
00:17:42,900 --> 00:17:47,370
actually specify the position of each item inside our list view.

271
00:17:47,520 --> 00:17:52,760
So first of all I'm going to actually get the data from the server and I want to put that Putin's to

272
00:17:52,770 --> 00:17:54,290
insight Arliss view.

273
00:17:54,330 --> 00:17:58,160
So as you can see here our layout is actually two line list item right.

274
00:17:58,170 --> 00:18:00,430
So now here I can say.

275
00:18:00,450 --> 00:18:03,200
So now let's actually put a pair of parenthesis here.

276
00:18:03,390 --> 00:18:06,310
And if you look at this lay out it says to line list idea.

277
00:18:06,310 --> 00:18:11,520
So this means that we have two text views inside are each item inside our item view.

278
00:18:11,520 --> 00:18:16,590
So first we have a pair of practices and inside is Apprentice's we want to actually put another pair

279
00:18:16,590 --> 00:18:19,430
of prentices and here inside the inner Apprentice's.

280
00:18:19,440 --> 00:18:24,780
I want to say text view because I want to actually cast this object to a text object right.

281
00:18:24,810 --> 00:18:30,530
And here I can't say view that find view by ID.

282
00:18:31,110 --> 00:18:37,090
Android dots are dot ID dot takes one.

283
00:18:37,170 --> 00:18:41,570
So this takes one is going to actually keep the first text so here the first line.

284
00:18:41,580 --> 00:18:42,910
Right we have to line.

285
00:18:42,990 --> 00:18:48,540
So this takes what is going to actually give us the first line the first text view.

286
00:18:48,720 --> 00:18:52,840
And here I can say that said text.

287
00:18:52,890 --> 00:18:58,950
So here I can actually get the name of a boxer model that gets Buxar name right.

288
00:18:59,130 --> 00:19:00,790
And we have another line.

289
00:19:00,840 --> 00:19:01,260
Right.

290
00:19:01,260 --> 00:19:06,780
So here again I put up her Apprentice's and then another practice's inside this prentices and inside

291
00:19:06,780 --> 00:19:10,250
the inner prentices I can just see a text view.

292
00:19:10,830 --> 00:19:18,670
And here I can see a view that fine view by ID or thought Id is me Android.

293
00:19:19,080 --> 00:19:21,240
Dots are dots.

294
00:19:21,420 --> 00:19:27,760
Id dot takes two text two because we have to lie.

295
00:19:27,960 --> 00:19:28,650
Right.

296
00:19:28,650 --> 00:19:36,510
So that takes two that said text model and now I want to get the punch power and upon speed so modern

297
00:19:36,720 --> 00:19:39,720
that gets up punch power.

298
00:19:40,200 --> 00:19:41,350
So a plus.

299
00:19:41,350 --> 00:19:47,950
So let me create a new line model that gets punch power plus and then life with two double calls.

300
00:19:47,970 --> 00:19:55,260
And then I actually create a new line character plus modern that gets punch speed.

301
00:19:55,260 --> 00:20:00,630
So in this way we can actually output the punch power and up and the punch speed here for takes two

302
00:20:00,990 --> 00:20:04,870
and it takes one is going to actually hold the value of the box certainly.

303
00:20:04,890 --> 00:20:08,210
Right so now let's run our application.

304
00:20:08,460 --> 00:20:12,920
And now let me show you the web browser and let me show you the emulator here.

305
00:20:12,930 --> 00:20:19,500
So now as you can see here we cannot see that data here inside our lease view.

306
00:20:19,590 --> 00:20:24,720
So let's go back to and would suit you and this means that we have actually an error and the error relates

307
00:20:24,720 --> 00:20:27,110
to adapt the adapter.

308
00:20:27,180 --> 00:20:32,540
And we forgot to actually set the file baseless adapter to our list view.

309
00:20:32,550 --> 00:20:38,460
So here I can say at least view or so after the end in embrace of our firebase list adapter and inside

310
00:20:38,460 --> 00:20:46,900
this uncreate method I can see list view that set adapter and the adapter is firebase list adapter.

311
00:20:46,980 --> 00:20:49,180
So now let's run that application again.

312
00:20:49,380 --> 00:20:51,630
Let me show you the web browser and the emulator.

313
00:20:51,630 --> 00:20:58,110
So now as you can see we can see these data here right inside Arliss view we have for example this item

314
00:20:58,140 --> 00:21:01,980
a want a zero as you can see and the boxes a punch.

315
00:21:01,980 --> 00:21:03,270
Power is 1000.

316
00:21:03,270 --> 00:21:05,070
And the punch spit is 2000.

317
00:21:05,250 --> 00:21:09,100
And we can see all these other box objects that we get from the set.

318
00:21:09,210 --> 00:21:09,770
Right.

319
00:21:10,110 --> 00:21:12,910
So now let's go back to android studio.

320
00:21:13,290 --> 00:21:15,770
And here I want to do something else here.

321
00:21:15,870 --> 00:21:22,440
Whenever the user clicks on one of these items here inside Ali's view I want that specific item that

322
00:21:22,440 --> 00:21:26,850
is actually clicked or you want that item to be deleted from our database.

323
00:21:26,970 --> 00:21:28,590
And from our list view.

324
00:21:28,590 --> 00:21:33,960
So first we need to actually make our views as you can see here we have this nice view.

325
00:21:34,140 --> 00:21:36,100
And each item has a view right.

326
00:21:36,120 --> 00:21:42,260
So I've only to actually make these views actually a listener to the clicks of the user.

327
00:21:42,270 --> 00:21:48,240
So inside our populate human effort as you can see here we get this argument which is of the view from

328
00:21:48,240 --> 00:21:49,830
this populate human right.

329
00:21:49,860 --> 00:21:55,170
So now inside these populate populate if you make it I can't say view I am referring to this argument

330
00:21:55,710 --> 00:21:59,060
that said unclick listener knew.

331
00:21:59,160 --> 00:22:04,530
And here I can't just hold the shift key on my keyboard and that person that person the leader Vicci

332
00:22:04,770 --> 00:22:09,870
on my keyboard and he had the autocomplete feature of Android studio is going to help you to choose

333
00:22:10,050 --> 00:22:10,690
this option.

334
00:22:10,710 --> 00:22:12,630
And then precedented on your keyboard.

335
00:22:12,810 --> 00:22:17,330
So now we have this unclick listener here and we have this uncle Mefford.

336
00:22:17,550 --> 00:22:22,190
So inside his uncle's effort to create first a toast does make text.

337
00:22:22,260 --> 00:22:26,650
So the first argument I need to pass the context make me an activity that this comma.

338
00:22:26,700 --> 00:22:36,040
And for the sake of argument I can say deleted deleted item at position the little item or position

339
00:22:36,080 --> 00:22:42,970
Kallen plus So as you can see from this populate Fuma we get the position right this argument so we

340
00:22:42,970 --> 00:22:49,010
can actually have access to the position of each item inside our lease view plus position.

341
00:22:49,150 --> 00:22:49,660
Right.

342
00:22:49,900 --> 00:22:51,230
And come on.

343
00:22:51,550 --> 00:22:58,060
And for the first argument I need to specify the length of our toaster so short that and then I need

344
00:22:58,060 --> 00:23:01,700
to call them if it show an object on our host object.

345
00:23:01,760 --> 00:23:02,200
Sure.

346
00:23:02,320 --> 00:23:04,000
So we have this host object here.

347
00:23:04,000 --> 00:23:07,970
So now let me actually create a new line so that you can see this post here.

348
00:23:08,200 --> 00:23:15,070
And now I want to put the logic in order to actually delete each item whenever the user clicks on each

349
00:23:15,130 --> 00:23:16,030
item view.

350
00:23:16,120 --> 00:23:17,020
Right.

351
00:23:17,030 --> 00:23:25,270
So first of all we need to have a reference to are actually to our specific ideas to our specific object.

352
00:23:25,270 --> 00:23:31,330
So as you can see here we need to have a reference for this actually to this object in order to delete

353
00:23:31,330 --> 00:23:31,480
it.

354
00:23:31,480 --> 00:23:37,230
So now let's actually go to our Android studio here and here inside this Anklage Smurfette.

355
00:23:37,300 --> 00:23:39,720
First we need to actually create our reference right.

356
00:23:39,730 --> 00:23:45,010
And the data type of this reference is actually database reference the name of this variable is actually

357
00:23:45,010 --> 00:23:47,920
my ref assignment operator.

358
00:23:48,610 --> 00:23:54,760
And here I can say firebase list adapter does get ref.

359
00:23:55,210 --> 00:23:57,070
And here we need to pass the position.

360
00:23:57,070 --> 00:24:00,970
So as you can see here we get the position from this populate view.

361
00:24:00,970 --> 00:24:01,400
Right.

362
00:24:01,420 --> 00:24:06,700
So inside the apprentice's I can't just pass this position in order to get that specific ID inside that

363
00:24:06,700 --> 00:24:08,080
specific position.

364
00:24:08,170 --> 00:24:08,710
Right.

365
00:24:08,770 --> 00:24:13,490
And here I can just as you can see we have this local variable which is of type database reference.

366
00:24:13,490 --> 00:24:19,720
Inside is an agreement if it and the name of this variable is made f and here I can say myself that

367
00:24:20,740 --> 00:24:23,450
remove value semi-colon.

368
00:24:23,650 --> 00:24:29,410
So in this way we can actually have the we can have the access to our specific idea and to a specific

369
00:24:29,490 --> 00:24:32,840
object inside a database and we can actually delete it.

370
00:24:32,980 --> 00:24:33,340
Right.

371
00:24:33,370 --> 00:24:37,600
And we can also delete that specific object inside our list view.

372
00:24:37,600 --> 00:24:44,260
So first let's actually do our project and now I can actually show you how we can delete all Buxar objects

373
00:24:44,290 --> 00:24:47,290
inside our database and our view.

374
00:24:47,290 --> 00:24:51,450
So let me show you the web browser and here it is our emulator right.

375
00:24:51,520 --> 00:24:58,990
So now as you can see this is our app 70 right and this is our boxed object and the box and it is a

376
00:24:58,990 --> 00:24:59,340
zero.

377
00:24:59,350 --> 00:25:00,750
And this is our box that object.

378
00:25:00,880 --> 00:25:04,840
So now I want to delete this item I want to delete the sparks that object here.

379
00:25:04,840 --> 00:25:10,870
So I just need to click on the item here and now it's a delete or deleted item at position 0 and the

380
00:25:10,870 --> 00:25:12,790
object is also deleted here.

381
00:25:12,820 --> 00:25:14,640
So we have this box name a word.

382
00:25:14,650 --> 00:25:15,160
Right.

383
00:25:15,220 --> 00:25:17,920
So now let me click on this item view here.

384
00:25:18,250 --> 00:25:20,680
And again this item is deleted here.

385
00:25:20,750 --> 00:25:22,590
I can also delete this too.

386
00:25:22,600 --> 00:25:24,610
So now let me open this idea here.

387
00:25:24,820 --> 00:25:29,670
As you can see it's as a two so I can just click on this item and now it is actually deleted.

388
00:25:29,950 --> 00:25:33,430
So I think that's enough for this Tauriel.

389
00:25:33,570 --> 00:25:39,690
And I actually got you lots of important concepts in this lesson.

390
00:25:39,760 --> 00:25:44,650
So if you have any questions please pass the discussion in the course and then I do my best to answer

391
00:25:44,920 --> 00:25:46,080
all of your questions.

392
00:25:46,090 --> 00:25:49,130
Thank you very much for watching and I'll see you in the next year to Audiard.

