1
00:00:00,270 --> 00:00:06,770
Pasear then in this whole you are willing to go ahead and create another Android application.

2
00:00:06,840 --> 00:00:13,950
And in this Hollier I want to talk about recycle view and how to connect our application to firebase

3
00:00:14,340 --> 00:00:20,780
and actually get that data from the pirate base and populate our recycle view of it that data that you

4
00:00:20,780 --> 00:00:22,830
receive from the firebase.

5
00:00:22,830 --> 00:00:26,250
So now let's create our new Android studio project.

6
00:00:26,250 --> 00:00:30,960
So just click on this start in your Android studio project and for the application and just type in

7
00:00:30,960 --> 00:00:33,340
here app sixty eight.

8
00:00:33,450 --> 00:00:39,240
And then here you can specify the company domain package name and pipe and project location and then

9
00:00:39,240 --> 00:00:41,450
click on next and here choose.

10
00:00:41,460 --> 00:00:46,640
AP A16 Android 4.1 Jelly Bean for a minimum SDK next.

11
00:00:46,920 --> 00:00:50,830
And here choose empty activity next.

12
00:00:50,910 --> 00:00:56,010
And here as you can see we have the activity name and the length name so don't change anything here

13
00:00:56,130 --> 00:01:00,530
just leave things as default as you can see here and then click on finish.

14
00:01:00,780 --> 00:01:04,980
So now let's actually connect our application to the firebase.

15
00:01:05,100 --> 00:01:09,850
So at the top click on Tools here and then click on firebase.

16
00:01:10,010 --> 00:01:12,390
So nice is going to open the assistant here.

17
00:01:12,400 --> 00:01:13,850
Firebase assistant.

18
00:01:13,960 --> 00:01:19,630
And then here click on real time database and then click on Save and retrieve data.

19
00:01:19,950 --> 00:01:23,860
So here first we need to actually connect our application to firebase.

20
00:01:23,900 --> 00:01:25,840
So just click on the spot in here.

21
00:01:25,920 --> 00:01:32,330
So here let's actually connect our application to an already existing project.

22
00:01:32,350 --> 00:01:34,760
OK so just click on this option here.

23
00:01:34,760 --> 00:01:39,830
Just check this radio button here and select apps 65 right.

24
00:01:39,900 --> 00:01:46,530
This is actually an already created Project so just select this project and then click on Connect to

25
00:01:46,530 --> 00:01:47,640
firebase.

26
00:01:47,640 --> 00:01:54,350
So as you can see here are firebase protected is created and connected locally to your app and now it's

27
00:01:54,420 --> 00:01:55,280
disconnected.

28
00:01:55,470 --> 00:02:00,620
So now it's time to add real time database to our Android application.

29
00:02:00,660 --> 00:02:07,660
So just click on this button at the realtime database to your app and then here accept changes.

30
00:02:07,660 --> 00:02:09,150
So now let's wait a little bit here.

31
00:02:09,160 --> 00:02:11,630
So now our project is ready.

32
00:02:11,710 --> 00:02:17,560
Right so now Arlott actually collapsed this assistance earlier this firebase assistant.

33
00:02:17,890 --> 00:02:23,550
And here let's first about that actually are designed to use an interface or application.

34
00:02:23,560 --> 00:02:28,480
So here just double click and this as for Dell double click on display out for that and then select

35
00:02:28,480 --> 00:02:32,560
this activity on the line minute Semmel and then double click on this file.

36
00:02:32,860 --> 00:02:35,160
So let me add to the double click on this tab here.

37
00:02:35,170 --> 00:02:40,630
In order to make this area either select this hello world takes you here and in person delete key on

38
00:02:40,630 --> 00:02:48,540
your keyboard and then here at the bottom selected the text tap and change the rel. out to linearly

39
00:02:48,550 --> 00:02:49,320
out.

40
00:02:49,780 --> 00:02:56,260
And now this actually specify the orientation of linear layout which is going to be vertical and it

41
00:02:56,260 --> 00:03:03,580
hit at the bottom select Design tab and now inside this palette section we want to actually drag our

42
00:03:03,910 --> 00:03:07,300
recycle view into this linear layout vertical.

43
00:03:07,330 --> 00:03:08,250
As you can see here.

44
00:03:08,410 --> 00:03:17,230
So now here inside these palettes extend to scroll down here and here are inside this custom as compact

45
00:03:17,260 --> 00:03:24,310
here as you can see we have this folder custom Dasch compact just as you can see we have this recycle

46
00:03:24,310 --> 00:03:25,270
view right.

47
00:03:25,270 --> 00:03:31,280
If I selected here it's going to actually show us a dialog and it says at Project dependency.

48
00:03:31,510 --> 00:03:35,090
So because we want to actually use the recycle view we have to use it.

49
00:03:35,110 --> 00:03:41,320
We have to actually add project 3 dependency to our application to our project and it says this operation

50
00:03:41,320 --> 00:03:45,990
requires that the right library recycle you dash 7.

51
00:03:46,090 --> 00:03:47,980
Would you like to add this library now.

52
00:03:48,070 --> 00:03:53,710
Yes if you want to add this library now to just click OK so it's going to actually add the library here

53
00:03:53,710 --> 00:03:55,570
to our project.

54
00:03:55,930 --> 00:03:59,220
And now we should wait a little bit here and it is refreshing.

55
00:03:59,230 --> 00:04:00,400
Firebase.

56
00:04:00,540 --> 00:04:05,790
So let's actually wait a little bit here and as you can see here we have rendering problems.

57
00:04:06,010 --> 00:04:11,920
So in order to solve this problem I just click on this build here at the top and then click on clean

58
00:04:11,940 --> 00:04:15,120
product.

59
00:04:15,310 --> 00:04:19,060
And now as you can see here the problem is now solved.

60
00:04:19,060 --> 00:04:25,740
OK so if you ever encounter these kinds of problems you just need to click on built at the top and then

61
00:04:25,750 --> 00:04:29,320
click on a clean project or rebuild project.

62
00:04:29,410 --> 00:04:30,000
Right.

63
00:04:30,230 --> 00:04:37,050
So now of any to actually add to firebase you database dependency to our project.

64
00:04:37,180 --> 00:04:38,790
So now let me show you.

65
00:04:38,890 --> 00:04:45,690
So at the top just click on View and then to live indoors and then click on project so now as you can

66
00:04:45,690 --> 00:04:51,510
see here we have these if you have the Android view here as you can see we have a great deal of scripts

67
00:04:51,510 --> 00:04:52,140
here.

68
00:04:52,300 --> 00:04:54,590
So now let me show you the web browser.

69
00:04:54,840 --> 00:05:02,670
So as you can see here I open this up here and you just need to enter this you all inside the search

70
00:05:02,670 --> 00:05:09,230
bar as you can say Good hop that can't slash firebase slash firebase you it that's android.

71
00:05:09,240 --> 00:05:12,670
And then here here you will be our guide guide to this page.

72
00:05:12,690 --> 00:05:14,050
So now let's scroll down here.

73
00:05:14,100 --> 00:05:16,710
As you can see we have this installation right.

74
00:05:16,830 --> 00:05:19,050
And here we have these dependencies.

75
00:05:19,050 --> 00:05:25,080
So if you want to add this dependency firebase you are a database only right because you want to use

76
00:05:25,080 --> 00:05:26,950
them firebase database.

77
00:05:26,970 --> 00:05:32,590
So if you just need to actually copy this code here just select it and then right click on your and

78
00:05:32,580 --> 00:05:34,640
this code and then click on copy.

79
00:05:34,890 --> 00:05:41,810
So now let's go back to android studio and here as you can see here inside these great scripts we have

80
00:05:41,810 --> 00:05:47,090
built that cradle project at 68 and we have that great module app.

81
00:05:47,250 --> 00:05:50,410
So this is actually the app level that cradle.

82
00:05:50,520 --> 00:05:53,650
And this is the project level build that cradle.

83
00:05:53,700 --> 00:05:58,920
And if I show you the web browser now it says in your app there will be that cradle.

84
00:05:58,920 --> 00:05:59,840
Here it is.

85
00:05:59,970 --> 00:06:04,900
So it is actually DoubleClick and this bill that cradle here amongst your app and inside is dependences

86
00:06:04,900 --> 00:06:06,410
bludge here.

87
00:06:06,480 --> 00:06:12,110
I just need to actually paste this code here and in here I just need to click on synch now.

88
00:06:12,210 --> 00:06:16,200
So now as you can see here it is actually synching our project.

89
00:06:16,200 --> 00:06:21,870
So as you can see here are here as you can see we have this error and if we actually hover over this

90
00:06:21,960 --> 00:06:29,430
error it says this support library should not use a different version 25 than the compiled SDK version

91
00:06:29,430 --> 00:06:30,070
24.

92
00:06:30,240 --> 00:06:37,170
So we can actually change this 24 25 to 24 and now we can actually a cinch.

93
00:06:37,230 --> 00:06:42,660
Now at the top if you can you can sync now and now as you can see here the error is solved.

94
00:06:42,690 --> 00:06:44,430
So let's wait a little bit here.

95
00:06:44,460 --> 00:06:47,030
So now it actually sync our project.

96
00:06:47,030 --> 00:06:48,680
So we have no errors here.

97
00:06:48,960 --> 00:06:52,340
So let's go back to our activity under the limited example.

98
00:06:52,530 --> 00:06:54,390
And here we have this recycle view.

99
00:06:54,420 --> 00:06:55,070
Right.

100
00:06:55,100 --> 00:07:01,710
So here inside as you can see here the recycle view is now gone because we actually changed the version

101
00:07:01,950 --> 00:07:05,540
of the library here inside this the dependences block.

102
00:07:05,670 --> 00:07:08,410
So let's go back to activity underlaid minute example here.

103
00:07:08,520 --> 00:07:11,990
So now I can just select this recycle view here again.

104
00:07:12,060 --> 00:07:16,630
And then I can just drag it and put it here Enceladus linearly out vertical.

105
00:07:16,860 --> 00:07:18,890
So here we have this recycle view.

106
00:07:18,960 --> 00:07:25,320
And again if I got it once inside this building great a file as you can see this error was because of

107
00:07:25,380 --> 00:07:26,880
this version.

108
00:07:26,880 --> 00:07:29,590
So let me actually open the Android SDK.

109
00:07:29,760 --> 00:07:34,170
So at the top I just need to click on Android studio and then preferences.

110
00:07:35,070 --> 00:07:40,740
And here I just need to just click on this appearance and behavior system settings and then click on

111
00:07:40,740 --> 00:07:47,580
Android SDK and then I just click on launch standalone SDK manager and as you can see here I have these

112
00:07:47,670 --> 00:07:52,450
Android 7 AP I-24 installed in my computer.

113
00:07:52,500 --> 00:07:53,040
Right.

114
00:07:53,040 --> 00:08:01,740
But if you have the Android seven point one point one AP I-285 you can actually use Ligny actually just

115
00:08:01,740 --> 00:08:02,660
close this window.

116
00:08:02,820 --> 00:08:07,480
You can use their religion at twenty five right.

117
00:08:07,530 --> 00:08:10,900
You can use the combat Android that support the recycle of you.

118
00:08:10,920 --> 00:08:14,690
That should be 725 that's 1.0 right.

119
00:08:14,730 --> 00:08:21,750
But because we have the API 24 I can't just use the API this originate 24 data point.

120
00:08:21,780 --> 00:08:23,060
That's zero.

121
00:08:23,190 --> 00:08:24,610
So this is really important.

122
00:08:24,660 --> 00:08:31,380
I just wanted to show you this very important feature or necessity of Android studio if you want to

123
00:08:31,380 --> 00:08:38,730
actually use the recycle view inside your inside there are projects inside your projects so they actually

124
00:08:38,730 --> 00:08:39,150
are close.

125
00:08:39,150 --> 00:08:40,560
The Android is the key here.

126
00:08:40,560 --> 00:08:45,450
So let's go back to actually with the underlying minute example and here is just select this recycle

127
00:08:45,450 --> 00:08:49,240
view and you can specify an idea for this recycle view.

128
00:08:49,290 --> 00:08:56,240
So here I can say recycle of you as an item recycle and then press that until she on your keyboard.

129
00:08:56,490 --> 00:09:01,250
So now let's actually go inside our main activity that java file.

130
00:09:01,560 --> 00:09:05,580
So first of all let's actually create a class a box or a class.

131
00:09:05,580 --> 00:09:07,900
So now let me show you their web browser here.

132
00:09:08,130 --> 00:09:09,380
Let me show it to firebase.

133
00:09:09,380 --> 00:09:15,120
So here I just need to click on go to console and if you remember we actually connected our application

134
00:09:15,390 --> 00:09:21,640
to an already created Project in firebase and that the project is at 65 right up 65.

135
00:09:21,720 --> 00:09:27,630
We actually connected our application of sixty eight to the app sixty five projects that we have in

136
00:09:27,630 --> 00:09:28,760
say the firebase.

137
00:09:28,770 --> 00:09:34,620
So I just need to select this at 65 and then I can just click on database and then here we should see

138
00:09:34,890 --> 00:09:36,210
we should actually see these data here.

139
00:09:36,270 --> 00:09:39,410
As you can see we have lots of Buxar objects here.

140
00:09:39,480 --> 00:09:45,690
So because we want to actually get these boxes objects of any to actually create about a boxer class

141
00:09:45,720 --> 00:09:47,210
inside our project.

142
00:09:47,310 --> 00:09:55,110
So if you or I actually have a box of class that you actually created in the previous projects we can

143
00:09:55,110 --> 00:10:01,470
actually copy that file and paste it here inside your Java folder inside your inside this package.

144
00:10:01,470 --> 00:10:01,740
Right.

145
00:10:01,740 --> 00:10:07,410
As you can see here in say the package that this main activity is in this our main activity is actually

146
00:10:07,410 --> 00:10:14,000
inside this package so you can't just copy that file that dogfight and paste it here inside this package.

147
00:10:14,160 --> 00:10:20,220
So now I just want to actually create a new class so I can just click on this packet and then click

148
00:10:20,220 --> 00:10:25,840
on dhaba class and it here for the name I can see Boxer and then click on.

149
00:10:25,870 --> 00:10:30,960
OK so now we have this Buxar class so let me actually double click on this tab in order to make this

150
00:10:30,990 --> 00:10:31,870
area there.

151
00:10:32,070 --> 00:10:37,980
So now let me show you the web browser as you can see we have the boxer named Boxer power and punch

152
00:10:38,430 --> 00:10:40,720
Boxer name punch power and punch speed.

153
00:10:40,740 --> 00:10:43,020
So we have this instance variables.

154
00:10:43,050 --> 00:10:58,360
So here I can't say private's strange Buxar name semi-colon private's and punch power semi-colon private

155
00:10:58,870 --> 00:11:03,540
and punch speed semi-colon.

156
00:11:03,760 --> 00:11:09,880
So now if you remember I told you that because I want to actually get box set objects from the server

157
00:11:10,120 --> 00:11:14,580
here we must create an empty constructor here for our boxer class.

158
00:11:14,590 --> 00:11:20,000
So I just need to right click here and then click on generate and then click on constructor.

159
00:11:20,050 --> 00:11:26,880
So if you are using a Windows machine you can just hold the control key on your keyboard and then select

160
00:11:26,880 --> 00:11:32,560
this instance variable in order to de-select this instance variable and if you are using a match you

161
00:11:32,560 --> 00:11:37,890
can hold the command key on your keyboard and then press on and then select this box.

162
00:11:37,890 --> 00:11:41,510
And in this instance variable in order to de-select this instance valuable.

163
00:11:41,770 --> 00:11:48,020
Or you can actually select this package right in this way you are de-select in all these variables right.

164
00:11:48,040 --> 00:11:52,510
In this way you are not selecting all these variables and then you can just click on.

165
00:11:52,530 --> 00:11:55,510
OK so now you have this enty constructor here.

166
00:11:55,540 --> 00:11:56,170
Right.

167
00:11:56,170 --> 00:12:02,590
So we need to create another constructor in order to initialize our instance variables of every other

168
00:12:02,590 --> 00:12:06,270
classes want to create a new object of type Buxar.

169
00:12:06,400 --> 00:12:13,330
So here I can't say I can just right click here and then click on generate and then click on constructor

170
00:12:13,690 --> 00:12:17,550
and then select all these instance variables and then click on OK.

171
00:12:17,680 --> 00:12:22,070
So as you can see here we have this constructor here generated for us.

172
00:12:22,270 --> 00:12:26,130
So we need to actually create getters for this instance variables.

173
00:12:26,140 --> 00:12:32,470
So again inside this class just right click here and then click on generate and then click on get here

174
00:12:32,650 --> 00:12:37,260
and then select all these instance variables and then click on OK.

175
00:12:37,570 --> 00:12:39,510
So if we have this get here is here.

176
00:12:39,610 --> 00:12:40,110
Right.

177
00:12:40,120 --> 00:12:42,430
So hopefully that makes sense.

178
00:12:42,460 --> 00:12:48,580
And now let's actually go to our main activity that are filed on here of when to actually first of all

179
00:12:49,120 --> 00:12:52,800
create some valuables inside our main activity class.

180
00:12:52,810 --> 00:12:55,380
So I'm going to actually paste in some lines of code here.

181
00:12:55,390 --> 00:13:00,450
Inside this main activity class and then I'm gonna explain to you what's going on here.

182
00:13:00,670 --> 00:13:07,030
So as you can see here these are the lines of code that I pasted here in line number 13.

183
00:13:07,060 --> 00:13:14,170
As you can see here I actually declared a variable and the name of this rally is box set and this variable

184
00:13:14,170 --> 00:13:18,260
is of type Boxer class right in line number 14.

185
00:13:18,290 --> 00:13:27,160
I actually declare it another variable which its data type is database reference and its name is database

186
00:13:27,160 --> 00:13:28,350
reference.

187
00:13:28,360 --> 00:13:36,190
And here in line number 15 as you can see here we have this firebase data hub firebase recycle recycler

188
00:13:36,250 --> 00:13:39,870
adapter as you can see here firebase recycler adapter.

189
00:13:40,150 --> 00:13:49,060
So we use this class we use an instance of this class in order to populate our recycle you with that

190
00:13:49,060 --> 00:13:52,550
data that you receive from the server.

191
00:13:52,570 --> 00:13:53,300
Right.

192
00:13:53,380 --> 00:13:56,110
Sort of from the firebase you are.

193
00:13:56,170 --> 00:13:57,200
As you can see here.

194
00:13:57,550 --> 00:14:04,010
Inside this bill that cradle here as you can see we actually added this dependency right firebase you

195
00:14:04,020 --> 00:14:06,790
are right by your best database.

196
00:14:06,890 --> 00:14:10,520
The inside is firebase you have this class right.

197
00:14:10,530 --> 00:14:17,160
Firebase recycler adapter so and it is used to populate our recycle we recycle recycle view with that

198
00:14:17,170 --> 00:14:20,640
data that we receive from the firebase database.

199
00:14:20,680 --> 00:14:21,490
Right.

200
00:14:21,490 --> 00:14:27,580
So here as you can see inside the angle brackets I provided to actually two data type here.

201
00:14:27,580 --> 00:14:34,480
The first data type here is there a box of objects that we want to actually receive from the firebase

202
00:14:34,480 --> 00:14:35,400
database.

203
00:14:35,440 --> 00:14:35,960
Right.

204
00:14:36,160 --> 00:14:40,040
And the second data type here as you can see is the view Holder.

205
00:14:40,180 --> 00:14:40,590
Right.

206
00:14:40,690 --> 00:14:47,710
So we use this view holder in order to hold the box of objects so it is necessary that you put these

207
00:14:47,710 --> 00:14:53,020
two types here inside the angle brackets after this firebase recycler adapter.

208
00:14:53,020 --> 00:14:54,230
This is really important.

209
00:14:54,580 --> 00:15:00,250
And then in line number 16 as you can see here we have another Raddy airborne and it is of type recycler

210
00:15:00,250 --> 00:15:05,320
view and its name is our recycler view right now.

211
00:15:05,380 --> 00:15:08,610
Let's actually go inside this uncreate method.

212
00:15:08,980 --> 00:15:14,920
And now let's actually initialize our valuables that we actually declared here inside our main activity

213
00:15:14,920 --> 00:15:15,880
class.

214
00:15:15,880 --> 00:15:21,490
So here again I'm going to pasting some lines of code and then you can actually stop the video and then

215
00:15:21,580 --> 00:15:23,440
you can actually write your code here.

216
00:15:23,440 --> 00:15:28,110
So as you can see here these are the lines of code that are in place here.

217
00:15:28,180 --> 00:15:34,780
So as you can see here in line number 28 I am actually initializing this recycler view right.

218
00:15:34,790 --> 00:15:38,040
We declared this recycle RVO in line number 18.

219
00:15:38,080 --> 00:15:41,060
As you can see here an inline number is 28.

220
00:15:41,080 --> 00:15:45,640
And inside this uncreate Smurfette we are initializing this recycler view.

221
00:15:45,690 --> 00:15:52,660
So the circular view assignment operator and here I am actually has think this object recyclers view

222
00:15:52,660 --> 00:15:59,510
to all recycle of view object so here so fine view by ID or that Id dot recycle view.

223
00:15:59,610 --> 00:16:05,610
So let's actually go to activity underline main and examine and essentially change the ID of the recycle

224
00:16:05,610 --> 00:16:08,300
view to recycle review right.

225
00:16:08,400 --> 00:16:12,170
Re cycler view.

226
00:16:12,710 --> 00:16:13,260
OK.

227
00:16:13,450 --> 00:16:16,150
And then press on and tell on your keyboard.

228
00:16:16,150 --> 00:16:18,250
I think it's better and it makes more sense.

229
00:16:18,250 --> 00:16:20,740
So let's actually go to main activity that have a file.

230
00:16:20,900 --> 00:16:23,320
And now there's actually a change here.

231
00:16:23,320 --> 00:16:27,700
This recycle you to recycle out of you and now it's OK.

232
00:16:27,700 --> 00:16:33,800
So in line number fretty as you can see here we need to actually set the layout manager on our recycle

233
00:16:33,850 --> 00:16:34,410
view.

234
00:16:34,690 --> 00:16:40,990
So if I go to our activity underline minute example here as you can see we have this activity underline

235
00:16:40,990 --> 00:16:44,360
main here and it is actually a linearly out vertical right.

236
00:16:44,650 --> 00:16:49,400
And we have this recycler view Enceladus linearly out vertical.

237
00:16:49,420 --> 00:16:52,180
So let's go to main activity of a file.

238
00:16:52,180 --> 00:16:58,510
So when we say setting the layout manager of this recycler view we are seeing that new.

239
00:16:58,690 --> 00:17:06,280
Here we want to create a new instance of layout manager a new layout manager and as you can see here

240
00:17:06,550 --> 00:17:08,920
it is actually a linear layout manager.

241
00:17:09,010 --> 00:17:09,550
Right.

242
00:17:09,550 --> 00:17:15,340
So here we are setting the layout manager of the recycler view and the layout manager of this recycler

243
00:17:15,390 --> 00:17:16,960
view is actually a linearly out.

244
00:17:16,960 --> 00:17:17,620
Why.

245
00:17:17,680 --> 00:17:21,570
Because this recycler view is actually inside a linear layout.

246
00:17:21,700 --> 00:17:27,220
So we're creating a new instance of linearly out of manager.

247
00:17:27,220 --> 00:17:28,010
Right.

248
00:17:28,120 --> 00:17:31,910
And here we need to pass the context main activity that this.

249
00:17:31,930 --> 00:17:36,090
So this is very important and inline number 32 as you can see here.

250
00:17:36,120 --> 00:17:42,010
I want to add to enable the offline capability of firebase Soulfire based database that get instance

251
00:17:42,010 --> 00:17:44,920
that said persistence enable true.

252
00:17:45,490 --> 00:17:51,510
So an inline number fretty free as you can see here I am initializing this database refence so database

253
00:17:51,520 --> 00:17:57,330
of friends assignment operator firebase database that get instance that get reference.

254
00:17:57,400 --> 00:18:03,360
So here as you can see it didn't actually create of a firebase database instance.

255
00:18:03,370 --> 00:18:03,810
Right.

256
00:18:03,820 --> 00:18:07,600
Got that reference directly from this instance.

257
00:18:07,600 --> 00:18:11,630
So firebase database that get instance that gets a reference.

258
00:18:11,630 --> 00:18:15,090
So in this way you can actually initialize your database or offense.

259
00:18:15,130 --> 00:18:21,790
And here in line number 34 I am actually again we need to actually put this line of code here in order

260
00:18:21,790 --> 00:18:25,480
to enable the offline capability of firebase.

261
00:18:25,480 --> 00:18:28,260
So that database offense fence that keeps him through.

262
00:18:28,320 --> 00:18:34,210
So these two lines of code here as you can see here are very that are necessary in order to actually

263
00:18:34,210 --> 00:18:37,230
enable the offline capability of firebase.

264
00:18:37,540 --> 00:18:42,240
And here you can see that we are getting the reference of our database for instance.

265
00:18:42,250 --> 00:18:45,610
So now as you can see we have an error.

266
00:18:45,790 --> 00:18:51,610
And as you can see we have this view holder here we passed this view Holder and this is actually an

267
00:18:51,670 --> 00:18:52,880
argument right.

268
00:18:52,900 --> 00:18:59,920
So we need this view holder in order to hold the Buxar objects that we received from the server.

269
00:18:59,920 --> 00:19:04,300
So let's actually create a view holder that this is going to be actually of our type.

270
00:19:04,300 --> 00:19:04,850
Right.

271
00:19:05,080 --> 00:19:07,750
So then we want to create our own type.

272
00:19:07,750 --> 00:19:09,560
We need to create a class.

273
00:19:09,790 --> 00:19:13,000
But here we want to create an inner class.

274
00:19:13,000 --> 00:19:19,100
So what do I mean by in a class and in a class is actually a class that is inside another class.

275
00:19:19,150 --> 00:19:19,780
Right.

276
00:19:19,890 --> 00:19:23,870
And and in a class is actually a class that is inside of another class.

277
00:19:23,890 --> 00:19:26,320
So here we have this main activity class.

278
00:19:26,350 --> 00:19:32,590
So after the end in curly brace of this uncreate Mefford and before the ending Crilley brace of this

279
00:19:32,590 --> 00:19:35,680
mean activity the class are able to create another class here.

280
00:19:35,680 --> 00:19:43,620
So here I can't say class right view holder view Holder right.

281
00:19:43,900 --> 00:19:48,670
And then here I can just open and close this class by using these curly braces.

282
00:19:48,670 --> 00:19:55,020
So here we have actually an inner class a class that is inside of another class and here.

283
00:19:55,120 --> 00:19:58,000
Let's specify the access modifier of this class.

284
00:19:58,000 --> 00:20:02,730
So this class is actually a public class and this class is actually a static class.

285
00:20:02,770 --> 00:20:03,380
Right.

286
00:20:03,390 --> 00:20:06,580
So for inner classes we use static.

287
00:20:06,790 --> 00:20:07,450
Right.

288
00:20:07,510 --> 00:20:17,080
And this in a class you hold there needs to extend from the recycler view dot view Holder.

289
00:20:17,440 --> 00:20:18,090
Right.

290
00:20:18,130 --> 00:20:23,050
So as you can see we have actually an inner class public static class view holder.

291
00:20:23,050 --> 00:20:25,500
So because this is actually an inner class we use static.

292
00:20:25,500 --> 00:20:26,320
Right.

293
00:20:26,410 --> 00:20:31,250
And this class extends from the recycler view that view holder.

294
00:20:31,600 --> 00:20:37,300
So now as you can see we have an error and it says there is no default constructor available in Android

295
00:20:37,300 --> 00:20:41,810
that supports that B-7 that widget that recycle attribute that view holder.

296
00:20:41,830 --> 00:20:44,480
So now we need to actually provide the constructor here.

297
00:20:44,770 --> 00:20:45,240
Right.

298
00:20:45,310 --> 00:20:50,140
And we need to actually initialize the constructor of the superclass.

299
00:20:50,170 --> 00:20:59,130
So here I can say Puplick view holder public view holder view Holder right.

300
00:20:59,320 --> 00:21:05,320
And then here I need to put a pair of prentices and then I need to open and close this constructed by

301
00:21:05,320 --> 00:21:09,710
using these curly braces and opening curly brace followed by our closing curly brace.

302
00:21:09,820 --> 00:21:14,650
So remember that I told you the name of the constructor must be the same as the name of the class.

303
00:21:14,680 --> 00:21:15,400
Right.

304
00:21:15,460 --> 00:21:18,220
And here inside is constructed as you can see.

305
00:21:18,220 --> 00:21:23,350
First let me show you that we have an error here and if we actually hover over this right here it says

306
00:21:23,350 --> 00:21:28,500
there is no default constructor here inside this recycle or you that you hold there.

307
00:21:28,600 --> 00:21:32,280
So here we need to initialize the constructor of the superclass.

308
00:21:32,290 --> 00:21:33,790
So here I can say super.

309
00:21:33,820 --> 00:21:40,830
And now here we have a problem of we don't know what is the constructor of the superclass.

310
00:21:40,840 --> 00:21:45,100
We don't know how the constructor of the superclass is actually structured.

311
00:21:45,130 --> 00:21:50,020
And we also don't know how the constructor of the superclass actually exits arguments.

312
00:21:50,020 --> 00:21:51,520
What kinds of arguments.

313
00:21:51,610 --> 00:21:54,020
The constructor of the superclass accept.

314
00:21:54,220 --> 00:22:01,180
So now in order to actually learn about the constructor of the superclass here I just need to hold the

315
00:22:01,180 --> 00:22:04,920
comment key on my keyboard and then click on this view holder here.

316
00:22:04,940 --> 00:22:09,840
And if you are using a Windows machine you need to hold the control Control-C on your keyboard and then

317
00:22:09,880 --> 00:22:11,850
click on this view holder here.

318
00:22:11,920 --> 00:22:12,330
Right.

319
00:22:12,430 --> 00:22:13,920
So I just click on it here.

320
00:22:14,350 --> 00:22:20,130
So here in order to find the constructor of this recycler view that the whole class.

321
00:22:20,250 --> 00:22:25,310
I can't just hold the common key on my keyboard and then put this on the letter F key on my keyboard.

322
00:22:25,480 --> 00:22:27,060
The letter F key on my keyboard.

323
00:22:27,070 --> 00:22:31,120
And if you are using a Windows machine you need to hold the control on your keyboard and then press

324
00:22:31,120 --> 00:22:33,430
on the leader F key on your keyboard.

325
00:22:33,820 --> 00:22:40,600
And here I can actually except for the view holder view holder and now as you can see we have this new

326
00:22:40,600 --> 00:22:44,920
holder class soulis scroll down here and that you can see here.

327
00:22:45,100 --> 00:22:49,130
This is actually the constructor of this of your whole class.

328
00:22:49,180 --> 00:22:49,670
Right.

329
00:22:49,690 --> 00:22:56,110
It says public view Holder and this constructor actually accepts what argument of type review and its

330
00:22:56,110 --> 00:22:57,240
name is item view.

331
00:22:57,430 --> 00:23:03,310
So inside this main activity class and inside in a class as you can see we have this if you hold the

332
00:23:03,370 --> 00:23:09,370
class this is actually a custom class that we created ourselves but this class is actually extending

333
00:23:09,970 --> 00:23:12,550
the recycler view that view holder class.

334
00:23:12,550 --> 00:23:17,670
So we must actually initialize the constructor of the superclass.

335
00:23:17,740 --> 00:23:24,100
So as you can see when we are actually creating our own constructor here inside this constructor First

336
00:23:24,100 --> 00:23:26,920
of all we need to initialize the constructor of the superclass.

337
00:23:26,950 --> 00:23:35,020
So I actually showed you that the constructor of the superclass this one is actually accepts an argument

338
00:23:35,020 --> 00:23:36,150
of type view.

339
00:23:36,190 --> 00:23:41,450
So let's go back to our main activity class and let's go inside this inner class right view holder.

340
00:23:41,770 --> 00:23:48,400
And here inside the apprentice's of this constructor let's specify that this constructor actually accepts

341
00:23:48,880 --> 00:23:52,210
an argument of type view and its name is item view.

342
00:23:52,420 --> 00:23:52,890
Right.

343
00:23:53,050 --> 00:23:56,290
And here I can say super item view.

344
00:23:56,290 --> 00:24:01,410
And in this way you are actually initializing the constructor of the superclass first.

345
00:24:01,480 --> 00:24:01,840
Right.

346
00:24:01,960 --> 00:24:05,680
And now we can actually put our own quotes here.

347
00:24:05,680 --> 00:24:06,240
So.

348
00:24:06,490 --> 00:24:13,210
So inside this whole there class let's actually declare somebody else here the first variable is going

349
00:24:13,210 --> 00:24:21,210
to be of type takes the view and the name is takes the view semi-colon and then it and the next variable

350
00:24:21,220 --> 00:24:23,900
that you want to declare here is actually the opposite view.

351
00:24:24,160 --> 00:24:29,630
And here I want to name it as item view or here I can say View right semicolon.

352
00:24:29,980 --> 00:24:35,860
So now as you can see look at this constructor here it is constructed is actually initializing the constructor

353
00:24:35,860 --> 00:24:42,190
of the superclass and the constructor of the superclass actually accepts an argument of type view and

354
00:24:42,190 --> 00:24:43,740
its name is item view right.

355
00:24:43,930 --> 00:24:48,450
And here in line number 53 We are calling super item V so here is.

356
00:24:48,500 --> 00:24:53,710
If you are actually initializing the constructor of the superclass we are calling the constructor of

357
00:24:53,710 --> 00:24:57,670
the superclass superclass and it is necessary to do that right.

358
00:24:57,970 --> 00:25:06,370
And why we have this argument here because in this way we have access to the view to the item view of

359
00:25:06,460 --> 00:25:09,850
each cell of our recycler view.

360
00:25:10,240 --> 00:25:11,380
Right.

361
00:25:11,380 --> 00:25:18,810
So what does that mean we can actually use this item view in order to actually a set of click listener

362
00:25:18,820 --> 00:25:20,210
for each item of view.

363
00:25:20,350 --> 00:25:25,630
And we can be notified whenever the user clicks on an on one of those actually cells.

364
00:25:25,630 --> 00:25:27,200
So let me show you that here.

365
00:25:27,250 --> 00:25:31,970
First of all let me actually initialize this takes you so this takes you here.

366
00:25:31,970 --> 00:25:36,110
I actually declare the stakes here in order to initialize it inside the constructor.

367
00:25:36,130 --> 00:25:39,640
So whenever the user uses one of these.

368
00:25:39,880 --> 00:25:46,610
One of the objects of this view Holder is going actually the access to the text view of that cell.

369
00:25:46,690 --> 00:25:53,840
So now let me show you that here takes the view assignment operator and here I can say first I need

370
00:25:53,840 --> 00:25:56,160
to cast this object to a text view object.

371
00:25:56,210 --> 00:25:56,950
Right.

372
00:25:57,050 --> 00:26:01,640
And here I want to access the text that is inside of that item view.

373
00:26:01,640 --> 00:26:08,170
So here first we have actually the item view and inside of that item view we have actually a text a

374
00:26:08,220 --> 00:26:09,000
text view.

375
00:26:09,140 --> 00:26:20,900
So first if you need to actually access the item view dot find view by ID or Android dot or dot ID dot

376
00:26:21,090 --> 00:26:22,930
text one semicolon.

377
00:26:22,940 --> 00:26:29,300
So in this way we can actually access the text one of that and to the item view and we are assigning

378
00:26:29,300 --> 00:26:30,810
that to the states the view.

379
00:26:30,830 --> 00:26:35,950
So whenever we call the view we can actually have access to that text.

380
00:26:36,320 --> 00:26:41,960
And now I want to actually allow the other classes for example this main activity class to access the

381
00:26:41,960 --> 00:26:43,160
view of that item.

382
00:26:43,190 --> 00:26:43,600
Right.

383
00:26:43,610 --> 00:26:47,800
We can't just refer to this argument outside of this class.

384
00:26:47,840 --> 00:26:53,750
For example in say this man with the class I can't just say if you hold that item view or I can't just

385
00:26:53,840 --> 00:27:03,250
say actually I can't just create an object of view there and then call it the item view on that object.

386
00:27:03,250 --> 00:27:06,740
It's not actually possible here because this is actually an argument.

387
00:27:06,740 --> 00:27:08,020
This is not a valuable.

388
00:27:08,120 --> 00:27:11,770
And here in line the other 49 I created are variable.

389
00:27:11,780 --> 00:27:12,720
In order to do that.

390
00:27:12,800 --> 00:27:17,730
So inside these constructed I can just initialize it is this variable of view.

391
00:27:17,750 --> 00:27:22,460
So here I can say View assignment operator eiter view semi-colon.

392
00:27:22,550 --> 00:27:28,710
So in this way we're actually assigning to this argument which is actually the view of that item right.

393
00:27:28,790 --> 00:27:34,880
We are assigning the view to this view and we now we can actually create objects of type view whole

394
00:27:34,890 --> 00:27:35,170
there.

395
00:27:35,330 --> 00:27:37,480
And now we can access these variables.

396
00:27:37,490 --> 00:27:43,490
For example I can say the object of that if you hold that dot takes the view or I can say the object

397
00:27:43,490 --> 00:27:45,750
of that you hold that view.

398
00:27:45,950 --> 00:27:46,640
Right.

399
00:27:46,730 --> 00:27:48,610
So now let me show you how we can use this.

400
00:27:48,720 --> 00:27:51,140
You hold a class and then it will make sense.

401
00:27:51,140 --> 00:27:53,630
So let's go back to our uncreate method.

402
00:27:53,840 --> 00:27:58,340
As you can see here we are as you can see before the end in curly brace of this uncreate my foot here

403
00:27:58,370 --> 00:28:03,290
inside this uncreate my foot I turn the light some more lines of code here.

404
00:28:03,410 --> 00:28:05,590
So inside this uncreate Smurfette.

405
00:28:05,600 --> 00:28:10,900
First let me actually show you these variables that we declared inside the main activity class.

406
00:28:10,910 --> 00:28:17,690
So inside this main activity class we actually didn't initialize the Buxar valuable as you can see here.

407
00:28:17,930 --> 00:28:20,930
And this adapter this Firebrace recycling adapter.

408
00:28:21,170 --> 00:28:23,740
So first let's actually to initialize this one here.

409
00:28:23,750 --> 00:28:26,050
This box are valuable.

410
00:28:26,120 --> 00:28:26,600
Right.

411
00:28:26,600 --> 00:28:29,070
So let's go back let's go inside our uncreate method.

412
00:28:29,240 --> 00:28:36,770
So I actually declare this valuable in order to show you that we can actually send lots of boxes objects

413
00:28:37,100 --> 00:28:39,050
to the server by using a for loop.

414
00:28:39,050 --> 00:28:41,120
So now let me show you how we can do that.

415
00:28:41,120 --> 00:28:44,200
First I need to create a for loop here.

416
00:28:44,400 --> 00:28:47,240
So as you can see here I am inside this uncreate MF'er right.

417
00:28:47,390 --> 00:28:53,390
And here inside the Prentice's of this for loop for us I need to actually provide a valuable and initial

418
00:28:53,390 --> 00:28:54,010
value right.

419
00:28:54,010 --> 00:28:57,200
So in our assignment operator zero.

420
00:28:57,200 --> 00:28:59,900
So I created a variable and its name is.

421
00:28:59,930 --> 00:29:02,970
And initially I assigned the value zero to this value.

422
00:29:03,140 --> 00:29:04,900
And here I am saying that Oh.

423
00:29:05,090 --> 00:29:10,910
So here I need to specify the condition in which determines how many times this fall is going to be

424
00:29:10,910 --> 00:29:11,950
executed.

425
00:29:11,960 --> 00:29:18,230
So here I can say that this follow up here is going to be executed until the value of this variable

426
00:29:18,230 --> 00:29:21,360
is actually less than 20 right semicolon.

427
00:29:21,830 --> 00:29:26,490
And then here I need to say that after each execution of this follow up it's going to actually exec

428
00:29:26,590 --> 00:29:29,550
is going to add one value to the value of this body.

429
00:29:29,900 --> 00:29:33,110
So here as you can see we have this box right here right.

430
00:29:33,110 --> 00:29:34,090
This is off the box.

431
00:29:34,100 --> 00:29:41,270
So now here I can say boxer so here I can actually create a new object of the Buxar right assignment

432
00:29:41,270 --> 00:29:43,590
operator and here I can see new.

433
00:29:43,670 --> 00:29:47,290
So I need to create a new box set like a new instance of the box.

434
00:29:47,300 --> 00:29:51,990
So I must put the new Q-Bot year new Buxar.

435
00:29:52,310 --> 00:29:58,910
Right and now I need to specify some arguments so the box of name for example is my boxer right.

436
00:29:58,970 --> 00:30:01,490
Comma the punch power for example.

437
00:30:01,480 --> 00:30:02,990
Two hundred and fifty.

438
00:30:03,260 --> 00:30:05,930
And the punch speed is three hundred and fifty right.

439
00:30:05,960 --> 00:30:06,590
Semi-colon.

440
00:30:06,650 --> 00:30:08,310
So this is our backs it up checked.

441
00:30:08,330 --> 00:30:12,820
We could actually just create our Buxar object here.

442
00:30:12,850 --> 00:30:15,540
I can I could just put the boxer type here.

443
00:30:15,750 --> 00:30:19,630
And for example I could delete this valuable here inside R-Maine with the class.

444
00:30:19,640 --> 00:30:20,690
Right.

445
00:30:20,780 --> 00:30:26,530
So I just declared and created this Buxar variable sparks that object.

446
00:30:26,580 --> 00:30:33,680
And I assigned this object to this box that roudy about right and now as you can see I can just send

447
00:30:33,740 --> 00:30:37,530
this box that object to any times to the set.

448
00:30:37,550 --> 00:30:43,100
So here I can say database reference dot for example typhoid.

449
00:30:43,390 --> 00:30:47,780
And now I need to specify a unique ID for each actually height.

450
00:30:47,780 --> 00:30:53,990
So for example if you have lots of time it's right we have lots of children in our database reference

451
00:30:54,530 --> 00:30:58,440
and each child must have a unique name right.

452
00:30:58,460 --> 00:31:03,080
Otherwise we cannot actually create children with the same name.

453
00:31:03,080 --> 00:31:09,740
So here in order to actually create a unique name a unique ID for our child here I can say they have

454
00:31:09,930 --> 00:31:14,200
friends that push that get.

455
00:31:14,820 --> 00:31:15,730
Right.

456
00:31:15,990 --> 00:31:23,840
And now I can actually create Actually I can send objects to each child so I can say that set value

457
00:31:24,080 --> 00:31:26,030
Buxar semicolon.

458
00:31:26,240 --> 00:31:33,350
So in this way we can actually send a to any instances of this type Buxar class to the server.

459
00:31:34,390 --> 00:31:37,810
So you could use these codes in order to send the box that up text to the server.

460
00:31:37,820 --> 00:31:40,750
But let me show you the web browser here.

461
00:31:40,870 --> 00:31:42,930
And let's go to go to console

462
00:31:45,820 --> 00:31:51,250
you know that we actually connected our application to the app 65 firebase project.

463
00:31:51,250 --> 00:31:58,720
So I just need to click on it here and I just need to click on database and here is when I see the issuance

464
00:31:58,990 --> 00:32:04,720
of a box of objects so we already have lots of box of objects with unique ID.

465
00:32:04,720 --> 00:32:10,070
Here we don't have to actually send a box that objects to this database here.

466
00:32:10,240 --> 00:32:11,900
So you can see these objects here right.

467
00:32:11,920 --> 00:32:15,670
And you can see these unique IDs so I.

468
00:32:16,090 --> 00:32:20,890
We don't need to use this for loop but I wanted to show you how we can actually send lots of Puckster

469
00:32:20,920 --> 00:32:22,580
objects by using a for loop.

470
00:32:22,630 --> 00:32:23,650
So this is very important.

471
00:32:23,650 --> 00:32:31,000
This is actually a very important design pattern that you can use in order to actually create and send

472
00:32:31,060 --> 00:32:32,440
objects to the server.

473
00:32:32,680 --> 00:32:38,470
So and now you want to actually initialize this or firebase recycle or adapter.

474
00:32:38,470 --> 00:32:38,730
Right.

475
00:32:38,740 --> 00:32:45,220
As you can see we actually declared this variable of type firebase recycler adapter here in line number

476
00:32:45,220 --> 00:32:48,320
19 and the same is Firebrace the second adapter right.

477
00:32:48,580 --> 00:32:51,730
And we did it initialize it yet we haven't initialized it yet.

478
00:32:51,730 --> 00:32:52,230
Right.

479
00:32:52,240 --> 00:32:55,610
So let's go inside our uncreate method and initialize it here.

480
00:32:55,810 --> 00:33:04,180
So here I can say firebase recycling after assignment operator and here I want to actually create a

481
00:33:04,180 --> 00:33:06,760
new instance of type firebase recycler adapter.

482
00:33:06,760 --> 00:33:06,970
Right.

483
00:33:06,970 --> 00:33:12,930
So here I can just put the new word on and then here I can say firebase recycle an adapter.

484
00:33:12,940 --> 00:33:13,480
Right.

485
00:33:13,660 --> 00:33:19,660
So here just use the first option that appears here right now you fired a second or it and now you can

486
00:33:19,660 --> 00:33:25,510
see he had the auto complete feature up and I stood your automatically provided these codes for us.

487
00:33:25,510 --> 00:33:28,130
So first as you can see here we have this and then curly brace.

488
00:33:28,150 --> 00:33:31,870
And here we have an error and it says we need to put a semicolon here.

489
00:33:32,050 --> 00:33:35,230
So this error is gone and we have another error.

490
00:33:35,260 --> 00:33:35,700
Right.

491
00:33:35,800 --> 00:33:37,790
And it says that here.

492
00:33:37,900 --> 00:33:41,980
This instance actually the constructor here needs some arguments.

493
00:33:41,980 --> 00:33:43,830
The first one is actually the model class.

494
00:33:43,840 --> 00:33:45,790
So we need to provide them with less.

495
00:33:45,980 --> 00:33:48,280
And the next one is the model layout.

496
00:33:48,370 --> 00:33:53,020
The first one is the view holder class so we actually we already created our view holder here.

497
00:33:53,020 --> 00:33:53,550
Right.

498
00:33:53,650 --> 00:34:01,210
And that's why I created this in a class here because this firebase cycle of it after constructor actually

499
00:34:01,210 --> 00:34:02,620
needs of you there.

500
00:34:02,650 --> 00:34:03,260
Right.

501
00:34:03,520 --> 00:34:06,810
And we also need to specify the database reference.

502
00:34:06,880 --> 00:34:09,760
So first as you can see here it says Model class right.

503
00:34:09,760 --> 00:34:15,950
So for the first argument we need to specify the model class that the model class is Boxer's class.

504
00:34:16,120 --> 00:34:16,810
Right.

505
00:34:16,840 --> 00:34:21,880
This is the model class this is the class that we actually created objects from.

506
00:34:22,060 --> 00:34:24,570
And we sense these objects to the server as you can see.

507
00:34:24,570 --> 00:34:26,320
Here let me show you the web browser.

508
00:34:26,680 --> 00:34:33,120
These are the box that updates right and now you want to actually get these objects here from the server.

509
00:34:33,340 --> 00:34:35,830
Right so that's why it is called the Model class.

510
00:34:35,830 --> 00:34:38,380
The model is that data the data source.

511
00:34:38,380 --> 00:34:39,100
Right.

512
00:34:39,100 --> 00:34:41,650
So now the second argument is the layout.

513
00:34:41,770 --> 00:34:42,410
Right.

514
00:34:42,430 --> 00:34:52,510
So here I can say Android dots are does layout dot to list a two line list item.

515
00:34:52,510 --> 00:34:52,940
Right.

516
00:34:52,960 --> 00:34:58,270
So this is going to be our layout if you want to use a tool list item lay out for our each for each

517
00:34:58,360 --> 00:35:04,490
item view so that we can actually print so that we can actually output some lines to there and try to

518
00:35:04,540 --> 00:35:06,960
each item view to each view.

519
00:35:06,970 --> 00:35:11,090
So we used to line list like that we could use simple this item also.

520
00:35:11,170 --> 00:35:17,890
So I use this one and for the first argument as you can see here we need to specify another argument

521
00:35:17,890 --> 00:35:18,340
here right.

522
00:35:18,340 --> 00:35:22,560
And the third argument is actually they view holding a class.

523
00:35:22,570 --> 00:35:26,490
So here I can say we're holer right.

524
00:35:26,520 --> 00:35:29,270
That class karma.

525
00:35:29,660 --> 00:35:35,060
So as you can see here we actually refer to this in a class view holder that we created here inside

526
00:35:35,120 --> 00:35:36,380
our main activity class right.

527
00:35:36,400 --> 00:35:37,700
This is our view holder class.

528
00:35:37,850 --> 00:35:43,730
So for the argument we need to specify the view the class and for the fourth argument which is actually

529
00:35:43,760 --> 00:35:49,340
a final argument we need to say if we need to pass that database reference and now as you can see here

530
00:35:49,340 --> 00:35:50,720
the error is gone.

531
00:35:50,780 --> 00:35:51,410
Right.

532
00:35:51,440 --> 00:35:58,060
So now let me actually create an ulang child actor here and now you can see that we have this firebase

533
00:35:58,070 --> 00:35:59,800
the cycle of after instance.

534
00:36:00,050 --> 00:36:06,950
So here as a case for the first argument we passed the box of that class for the sake of argument we

535
00:36:06,950 --> 00:36:12,720
said and Royte that art that lay out the two line items so this is going to be the layout of each IDM

536
00:36:12,740 --> 00:36:14,270
view as you can see here.

537
00:36:14,840 --> 00:36:19,460
And for the first argument be passed if you hold that class that be created here.

538
00:36:19,580 --> 00:36:20,330
Right.

539
00:36:20,810 --> 00:36:24,800
And for the fourth argument to be passed the database reference.

540
00:36:24,800 --> 00:36:30,020
So now we have this populate view Holder right.

541
00:36:30,020 --> 00:36:36,290
So that populate view hall method is going to actually populate our view holders inside our recycle

542
00:36:36,330 --> 00:36:40,320
or view with the objects of type Buxar right.

543
00:36:40,340 --> 00:36:44,440
So we already have these arguments here so we can use these arguments here.

544
00:36:44,450 --> 00:36:44,980
Right.

545
00:36:44,990 --> 00:36:50,260
So let's go inside just populate you hold their method here aren't here inside this populate view method.

546
00:36:50,270 --> 00:36:54,980
I can say for example as you can see we have an argument of type view hold right.

547
00:36:54,980 --> 00:37:01,160
So this is actually an object of type view holder that we are receiving from the Smurfette and whenever

548
00:37:01,160 --> 00:37:03,950
we use this object we are the author.

549
00:37:04,030 --> 00:37:10,910
The constructor of this view here is actually automatically called and these values are actually initialized.

550
00:37:10,910 --> 00:37:16,890
So for example this text the view is actually initialized and we have access to the text one of that

551
00:37:16,920 --> 00:37:20,910
item view or we have access to that item view here itself.

552
00:37:21,050 --> 00:37:21,640
Right.

553
00:37:21,680 --> 00:37:28,340
So here I can say for example if you hold their right dot and as and now as you can see here I can access

554
00:37:28,340 --> 00:37:29,960
the view and that he actually view.

555
00:37:29,960 --> 00:37:36,170
So here I can say it takes the view that said text and inside the apprentice's I can say as you can

556
00:37:36,170 --> 00:37:40,270
see here as the as the second argument we have this model which is of a boxer right.

557
00:37:40,280 --> 00:37:48,290
So here I can see a model that gets Boxer name plus two double quotes backward slash and which is actually

558
00:37:48,290 --> 00:37:51,490
a newline character plus model.

559
00:37:52,090 --> 00:37:55,470
Does that Boxer get punch power.

560
00:37:55,520 --> 00:37:55,980
Right.

561
00:37:56,060 --> 00:38:03,410
So now let me create a new line character here a new line and then here I can't say plus two double

562
00:38:03,410 --> 00:38:12,840
quotes by four slash n plus model that gets punch speed and here.

563
00:38:12,980 --> 00:38:17,370
Now we can actually output these values to the screen to each item in view.

564
00:38:17,450 --> 00:38:18,070
Right.

565
00:38:18,080 --> 00:38:25,470
So now as you can see after the end the curly brace the ending curly brace of these firebase recycle

566
00:38:25,530 --> 00:38:26,490
adapter here.

567
00:38:26,750 --> 00:38:30,700
And before the end in calibers of this uncreate Smurfette all you need to do.

568
00:38:30,740 --> 00:38:34,810
One more thing here I need to actually set the adapter.

569
00:38:35,000 --> 00:38:40,060
I need to set the firebase cycle adapter for our recycler view.

570
00:38:40,070 --> 00:38:40,550
Right.

571
00:38:40,670 --> 00:38:46,760
So now the recycling view doesn't know anything about the firebase recycler adapter and the adapter.

572
00:38:46,760 --> 00:38:54,560
The job of the adapter is going to is to actually get the data from the model and put those data inside

573
00:38:54,600 --> 00:39:00,030
our recycler view and that's the only job of the adapter so we must actually set the adapter here.

574
00:39:00,170 --> 00:39:02,600
So here I can say the recycler view.

575
00:39:02,700 --> 00:39:03,270
Right.

576
00:39:03,350 --> 00:39:08,120
That sets adapter firebase recycled adapter.

577
00:39:08,120 --> 00:39:08,740
Right.

578
00:39:08,820 --> 00:39:12,440
And now let's run our project and see what happens.

579
00:39:12,440 --> 00:39:18,890
So now I need to actually select one of these virtual devices so I choose this one Nexus 6 AP I-24 and

580
00:39:18,890 --> 00:39:19,730
then I need to click on.

581
00:39:19,740 --> 00:39:24,760
OK so now as you can see here these are the data that we receive from the server.

582
00:39:24,770 --> 00:39:25,150
Right.

583
00:39:25,190 --> 00:39:27,750
So here we can see that a b c d.

584
00:39:27,800 --> 00:39:29,890
Now let me show you a web browser here.

585
00:39:29,900 --> 00:39:32,250
So for example the first object is a.

586
00:39:32,300 --> 00:39:40,560
And the punch power is a 100 and the punt speed is actually 200 right so you can see these objects here.

587
00:39:40,640 --> 00:39:42,400
Here inside our recycler view.

588
00:39:42,410 --> 00:39:48,470
So I think that's enough for this year 30 or so if you have any questions please post a discussion in

589
00:39:48,470 --> 00:39:51,830
the course and then I'll do my best to answer all of your questions.

590
00:39:51,830 --> 00:39:55,070
Thank you very much for watching and I'll see you in the next year Tauriel.

