1
00:00:00,150 --> 00:00:05,970
High students in this year Tauriel you're going to go ahead and create another Android app.

2
00:00:06,030 --> 00:00:06,850
So just click on this.

3
00:00:06,870 --> 00:00:11,550
Start any Android studio project and for the application name just say in here.

4
00:00:11,670 --> 00:00:19,160
Sixty seven and you can specify the company domain package name and the project location here.

5
00:00:19,320 --> 00:00:28,410
So now click next and he'll choose API 16 Android 4.1 Jelly Bean for the minimum SDK and then click

6
00:00:28,410 --> 00:00:29,460
on next.

7
00:00:29,700 --> 00:00:32,330
And he had to empty activity next.

8
00:00:32,640 --> 00:00:34,870
And here don't change anything.

9
00:00:35,010 --> 00:00:37,660
As you can see here just leave things as default.

10
00:00:37,740 --> 00:00:39,000
And then he can finish.

11
00:00:39,000 --> 00:00:42,720
So now let's connect our application to the firebase.

12
00:00:42,720 --> 00:00:51,790
So at the top just click on Tools and then click on firebase and here click on real time database and

13
00:00:51,790 --> 00:00:54,310
then click on Save and retrieve data.

14
00:00:54,310 --> 00:00:57,600
First of all just click on this or connected to firebase.

15
00:00:57,670 --> 00:01:02,720
And here this time we don't want to create a new firebase project here.

16
00:01:02,760 --> 00:01:10,390
We want to actually select an already created Project right so choose an existing firebase or a Google

17
00:01:10,390 --> 00:01:11,370
project search.

18
00:01:11,440 --> 00:01:15,070
Make sure to actually take this radio button.

19
00:01:15,340 --> 00:01:21,520
And here we want to actually connect our application to the app sixty eight tests one firebase project.

20
00:01:21,520 --> 00:01:27,850
So here because you don't have app sixty eight tests one just select app sixty five.

21
00:01:27,850 --> 00:01:28,740
Is that right.

22
00:01:28,820 --> 00:01:35,530
Select app 65 and then click on Connect to firebase And now as you can see here it says Fire is project

23
00:01:35,530 --> 00:01:38,140
created and connected locally to migrate app.

24
00:01:38,170 --> 00:01:39,950
And here it says connected.

25
00:01:40,000 --> 00:01:44,080
So now we need to actually Connelly's at the real time database to your app.

26
00:01:44,080 --> 00:01:47,710
So just click on it and then click on accept changes.

27
00:01:47,710 --> 00:01:50,530
So now our our product is actually ready.

28
00:01:50,770 --> 00:01:57,980
So first we want to use actually an other feature of firebase which is called firebase.

29
00:01:58,270 --> 00:02:02,690
So first we need to actually to get that dependency from the Internet.

30
00:02:02,740 --> 00:02:05,360
So analysts actually open our Web browser here.

31
00:02:05,560 --> 00:02:08,020
So as you can see here this is my firebase.

32
00:02:08,020 --> 00:02:12,370
So firebase that Google does come and here click on go to console.

33
00:02:12,400 --> 00:02:17,190
We actually connected our application to this project at sixty eight test one.

34
00:02:17,260 --> 00:02:24,730
So now I just need to click on this database here and now we should wait and you can see these objects

35
00:02:24,730 --> 00:02:25,050
here.

36
00:02:25,050 --> 00:02:27,750
So you are already familiar with these objects.

37
00:02:27,760 --> 00:02:35,110
We created these objects in the previous Oriol in the previous application and we sent this data to

38
00:02:35,110 --> 00:02:35,900
the server.

39
00:02:36,130 --> 00:02:41,320
So now let's actually just open another tab here right.

40
00:02:41,480 --> 00:02:45,280
And here as you can see you just need to enter this you r l here.

41
00:02:45,520 --> 00:02:51,150
I'll get hop dot com slash firebase slash firebase you dash Android.

42
00:02:51,190 --> 00:02:53,910
Make sure to actually enter this you aren't here.

43
00:02:54,160 --> 00:02:56,390
And then you will be guided to this page here.

44
00:02:56,530 --> 00:02:57,010
Right.

45
00:02:57,220 --> 00:03:03,800
And if you scroll down here as you can see of first of we need to actually put the dependency.

46
00:03:03,820 --> 00:03:06,510
So here in here it says installation right.

47
00:03:06,730 --> 00:03:13,420
As you can see here and here we need to actually copy this dependency which is for firebase database

48
00:03:13,510 --> 00:03:20,500
only so here because we are interacting with the firebase database we need to copy this code here right.

49
00:03:20,500 --> 00:03:22,000
If you need to copy this line of code.

50
00:03:22,090 --> 00:03:27,600
So just as highlighted here and selected and just right click on it and then click on copy at the top

51
00:03:27,610 --> 00:03:31,620
here it says in your app level beyond that great deal.

52
00:03:31,660 --> 00:03:36,860
So let's go back to our Android studio and here as you can see here.

53
00:03:36,910 --> 00:03:42,240
If it is actually the Android view here you just need to open this cradle scripts.

54
00:03:42,250 --> 00:03:45,080
And here we have to build that cradle files.

55
00:03:45,190 --> 00:03:47,270
The first one is the project level.

56
00:03:47,350 --> 00:03:52,720
As you can see here and the second one is the build that built that cradle 5.

57
00:03:52,870 --> 00:03:54,430
And it says means your app.

58
00:03:54,460 --> 00:03:57,030
So we just need to double click on this one here.

59
00:03:57,160 --> 00:04:03,580
And if you are using the departure level here you just need to click on these two little triangles and

60
00:04:03,580 --> 00:04:05,750
then he had just click on this project.

61
00:04:06,130 --> 00:04:11,590
And here if I open this folder here as you can see we have built that cradle here that is inside of

62
00:04:11,590 --> 00:04:18,220
this project here and it is called the project level bill that cradle and we have this Apfel there and

63
00:04:18,220 --> 00:04:20,650
we have also this build that cradle here.

64
00:04:20,710 --> 00:04:21,400
Right.

65
00:04:21,430 --> 00:04:25,480
So we need this app Libelle built that cradle.

66
00:04:25,780 --> 00:04:30,730
So now let me actually double click on this one here and just have in order to make his area there and

67
00:04:30,730 --> 00:04:35,480
here we need to actually paste that code inside this dependences Block.

68
00:04:35,530 --> 00:04:37,920
And here at the top just click on scene now.

69
00:04:37,930 --> 00:04:44,070
So now we successfully installed the firebase you are in database right.

70
00:04:44,140 --> 00:04:49,930
So now let's actually go to our activity underlying main that examined and here is just selectees Hello

71
00:04:50,070 --> 00:04:53,360
takes you and then I press on delete key on your keyboard.

72
00:04:53,530 --> 00:04:57,550
So Linus actually tried a list view into this layout.

73
00:04:57,550 --> 00:05:04,840
First of all at the bottom just click on this text tap here and now is actually the change this is relatively

74
00:05:04,840 --> 00:05:07,600
out to linearly out right.

75
00:05:07,630 --> 00:05:10,220
And now we should specify the orientation.

76
00:05:10,240 --> 00:05:16,510
So before the end impact of this linearly out here just type in here all the Android orientation and

77
00:05:16,510 --> 00:05:17,780
choose vertical.

78
00:05:18,280 --> 00:05:21,470
And here at the bottom just click on design tab here.

79
00:05:21,550 --> 00:05:26,060
So and its next to the center for the list view here as you can see we have these containers folder

80
00:05:26,630 --> 00:05:32,130
and in so its container folder we have this list view here right.

81
00:05:32,170 --> 00:05:36,680
Just select it and try and get here into this linearly out vertical.

82
00:05:36,940 --> 00:05:40,000
And now heres select this a list view here.

83
00:05:40,120 --> 00:05:49,080
And for the ID just type in here list view and then person here on your keyboard now we have this list

84
00:05:49,080 --> 00:05:49,630
view.

85
00:05:49,680 --> 00:05:55,950
Let's go back to our main activity the java file here and our First of all we need to actually create

86
00:05:55,950 --> 00:05:59,080
a class actually a box at a class.

87
00:05:59,100 --> 00:05:59,870
Right.

88
00:05:59,940 --> 00:06:05,940
So now are here that this actually change this project view to Android view.

89
00:06:05,940 --> 00:06:10,040
So really this little triangle here and then click on Android.

90
00:06:10,320 --> 00:06:16,630
And now as you can see inside this app for live inside is a that we have this package just a selected

91
00:06:16,640 --> 00:06:17,430
spec each year.

92
00:06:17,450 --> 00:06:23,950
And at the top or click on File New and then click on Java class and for the name of your class.

93
00:06:23,960 --> 00:06:27,730
Step in here Boxer and here don't change anything.

94
00:06:28,020 --> 00:06:28,550
And click on.

95
00:06:28,590 --> 00:06:29,450
OK.

96
00:06:29,960 --> 00:06:33,210
And now double click on this tab here box set The Java.

97
00:06:33,590 --> 00:06:39,990
And now inside this box of a class let's actually create some instance variables so I can say private

98
00:06:40,740 --> 00:07:01,020
strange Buxar name right semicolon private and punch power semicolon probates and Ponch speed semicolon.

99
00:07:01,030 --> 00:07:03,720
So now let me show you the web browser here.

100
00:07:04,090 --> 00:07:10,590
And because we actually connected our application to the to this project absence the eight tests one

101
00:07:11,160 --> 00:07:14,960
of as you can see this is the boxer named punch power and punch speed.

102
00:07:14,970 --> 00:07:17,280
So we have these instance variables here.

103
00:07:17,280 --> 00:07:18,120
Right.

104
00:07:18,180 --> 00:07:25,440
So now as I told you because you want to actually interact with the firebase database first here because

105
00:07:25,440 --> 00:07:31,770
this is a class that we are going to create objects and we are going to send the objects that are created

106
00:07:31,770 --> 00:07:37,790
from this class to the firebase we need to actually create an empty constructor here first.

107
00:07:37,800 --> 00:07:40,520
So here I can just type in here public.

108
00:07:40,800 --> 00:07:46,920
So the access modifier of my constructor is public and the name of the constructor must be the same

109
00:07:47,160 --> 00:07:48,500
as the name of the class.

110
00:07:48,720 --> 00:07:52,170
And then I need to put a pair of parenthesis here and then I just need to open and close.

111
00:07:52,170 --> 00:07:57,330
These are constructed by using these curly braces and opening curly brace followed by a closing curly

112
00:07:57,330 --> 00:07:58,230
brace.

113
00:07:58,230 --> 00:08:04,810
And now let's actually create another constructor in order to initialize these instance variables.

114
00:08:04,800 --> 00:08:06,710
So here I can just right click on that.

115
00:08:06,710 --> 00:08:14,460
Inside this class and in here I can click on generate and click on constructor and select all these

116
00:08:14,460 --> 00:08:17,760
instance variables and then click on OK.

117
00:08:17,880 --> 00:08:24,120
So now as you can see here the Andrys pseudo-ID generated a constructor for us automatically.

118
00:08:24,150 --> 00:08:29,580
So now we need to actually create get here for for instance valuable well so as you can see here the

119
00:08:29,610 --> 00:08:34,780
access modifier of these instance variable variables is actually private.

120
00:08:34,890 --> 00:08:41,970
So we need to provide getters here in order to allow other classes to access the value of these instance

121
00:08:41,970 --> 00:08:42,750
variables.

122
00:08:42,750 --> 00:08:49,380
So here I can just right click here and then click on generate and then click on get here and here select

123
00:08:49,440 --> 00:08:52,670
all these instance variables and then click on OK.

124
00:08:52,980 --> 00:08:56,070
So here we have these getters here.

125
00:08:56,070 --> 00:08:59,400
So let's go back to our main activity that are filed here.

126
00:08:59,940 --> 00:09:06,390
And first of all of any to actually declare inside this main activity class we need to declare our list

127
00:09:06,390 --> 00:09:11,470
view valuable so list view and the name of this valuable is list view.

128
00:09:11,490 --> 00:09:15,300
So in so it is uncreate me effectless actually initialize this list.

129
00:09:15,300 --> 00:09:17,130
So here I can see list view.

130
00:09:17,220 --> 00:09:24,990
Assignment operator and I need to cast this object to have a list view object find view by ID or ID

131
00:09:25,050 --> 00:09:26,730
that list view.

132
00:09:26,730 --> 00:09:32,520
So we call them so now because we want to interact with the firebase database so when we need to actually

133
00:09:33,420 --> 00:09:40,170
declare some variables here inside this man to class the first variable is firebase database and the

134
00:09:40,170 --> 00:09:42,780
name of a database semicolon.

135
00:09:43,070 --> 00:09:49,430
And the second variable is database reference and the name is then the name of this variable is database

136
00:09:49,430 --> 00:09:50,940
reference semicolon.

137
00:09:51,390 --> 00:09:56,980
And inside this uncreate method I also want to actually enable the offline capability.

138
00:09:57,060 --> 00:10:04,020
So here I can say failure rates database does get instance that said persistence enabled.

139
00:10:04,020 --> 00:10:05,340
True.

140
00:10:05,790 --> 00:10:14,970
So and then we need to actually just listen to initialize our variables for database assignment operator

141
00:10:15,360 --> 00:10:22,350
and here I can say Firebrace database that get instance semicolon and actually initialize our database

142
00:10:22,350 --> 00:10:26,150
reference database reference assignment operator.

143
00:10:26,400 --> 00:10:36,390
And here I can say database that gets the reference semicolon on here and just a database reference

144
00:10:37,420 --> 00:10:41,220
does keep seemed true.

145
00:10:41,310 --> 00:10:48,590
So in this way we actually enabled the offline capability and we also initialized valuables the database

146
00:10:48,620 --> 00:10:49,850
and the database reference.

147
00:10:49,850 --> 00:10:53,150
So now we can actually interact with the firebase database.

148
00:10:53,150 --> 00:10:59,220
So here are because we actually added the fireplace you are a database to our application.

149
00:10:59,220 --> 00:11:07,010
We actually installed that dependency populate our list view feed the data that we actually receive

150
00:11:07,010 --> 00:11:08,190
from the server.

151
00:11:08,450 --> 00:11:10,270
So let's see how we can do that.

152
00:11:10,280 --> 00:11:16,670
So if you remember from the previous section as of this course I told you that if you want to populate

153
00:11:16,670 --> 00:11:23,450
your list view of that data up first you need to create an adapter so an adapter is going to actually

154
00:11:23,660 --> 00:11:27,190
populate your view with that data.

155
00:11:27,410 --> 00:11:27,700
Right.

156
00:11:27,710 --> 00:11:29,470
That's the job of the adapter.

157
00:11:29,630 --> 00:11:35,480
So because we want to actually get the data from the firebase database we need to actually create a

158
00:11:35,480 --> 00:11:38,250
firebase list adapter.

159
00:11:38,330 --> 00:11:38,930
Right.

160
00:11:38,960 --> 00:11:44,930
So inside our main activity class let's actually declare a firebase list adapter variable so I can say

161
00:11:44,930 --> 00:11:47,980
firebase least adapter.

162
00:11:48,050 --> 00:11:48,510
Right.

163
00:11:48,650 --> 00:11:52,150
Just select it and then press an interview on your keyboard.

164
00:11:52,370 --> 00:11:55,560
And this class is actually inside the firebase.

165
00:11:55,600 --> 00:12:01,520
You are the database that dependency that we installed up inside our application.

166
00:12:01,700 --> 00:12:06,390
So firebase this adapter and then Aimee's firebase this adapter semi-colon.

167
00:12:06,530 --> 00:12:07,140
Right.

168
00:12:07,380 --> 00:12:13,110
And now let's actually go inside this uncreate method and this actually initialize our firebase list

169
00:12:13,120 --> 00:12:13,760
that actor.

170
00:12:13,760 --> 00:12:19,700
So here I just need to refer to the name of my valuable Firebrace this adapter assignment operator new

171
00:12:20,120 --> 00:12:22,130
firebase list adapter.

172
00:12:22,130 --> 00:12:27,440
So as you can see here just hold the shift key on your keyboard and then press on the letter F key on

173
00:12:27,440 --> 00:12:33,830
your keyboard and then did the auto complete feature of the Android studio is going to help you to choose

174
00:12:33,830 --> 00:12:34,370
this option.

175
00:12:34,370 --> 00:12:35,650
Fire basically Siddartha.

176
00:12:35,810 --> 00:12:40,170
And now as you can see here inside the curly braces we have dot dot dot.

177
00:12:40,280 --> 00:12:43,660
Just select this option and then person enter key on your keyboard.

178
00:12:43,830 --> 00:12:49,640
And now as you can see here the autocomplete feature of the Android studio is going to help you to actually

179
00:12:50,090 --> 00:12:51,590
use these coats.

180
00:12:51,620 --> 00:12:57,310
So as you can see here at the end of this curly brace we need to put a semi-colon on here.

181
00:12:57,410 --> 00:13:03,740
As you can see it is when we actually created a new object a new instance of type firebase licit after

182
00:13:03,740 --> 00:13:05,870
we need to actually provide some arguments.

183
00:13:05,870 --> 00:13:11,960
So inside the Prentice's as you can see here we need to first of all specify the context the activity

184
00:13:12,470 --> 00:13:17,470
and then we need to specify the model and then we need to specify the model layout.

185
00:13:17,690 --> 00:13:19,800
And finally if you need to specify the reference.

186
00:13:19,910 --> 00:13:26,300
So let's actually go inside the curly inside Apprentice's of this constructor as you can see here and

187
00:13:26,390 --> 00:13:26,940
now.

188
00:13:26,960 --> 00:13:31,580
So for the first argument I can say main activity that is.

189
00:13:31,580 --> 00:13:36,770
So this is the context the semicolon and the second argument is going to be the model class.

190
00:13:36,770 --> 00:13:42,510
So the model that we actually want to use is the Boxer class as you can see here.

191
00:13:42,710 --> 00:13:49,190
If you're if I show you the web browser here as you can see if you have lots of box set objects as you

192
00:13:49,190 --> 00:13:55,810
can see here these are parts that objects and began to populate our list view of the box of objects.

193
00:13:55,820 --> 00:13:58,790
So the model class is going to be.

194
00:13:58,890 --> 00:14:05,090
So let's go to and listen so you and go to main activity the Java the model class is the box art class.

195
00:14:05,110 --> 00:14:05,990
So just they've been here.

196
00:14:05,990 --> 00:14:09,120
Boxer dart class right.

197
00:14:09,140 --> 00:14:09,850
Come on.

198
00:14:10,070 --> 00:14:12,850
And for the first argument we need to specify the layout.

199
00:14:12,850 --> 00:14:15,890
So now let me actually create a new line here.

200
00:14:16,010 --> 00:14:23,490
So for the first argument of you need to specify the layout so the layout layout is Android Android

201
00:14:23,790 --> 00:14:34,300
dogs are taught lay out that simple list IDM Vaughan select this one here and comma and finally you

202
00:14:34,300 --> 00:14:36,480
need to specify the database reference.

203
00:14:36,490 --> 00:14:39,060
So here I just need to type in database reference.

204
00:14:39,370 --> 00:14:42,820
So these are the arguments that we need to specify here.

205
00:14:43,090 --> 00:14:50,280
If you want to actually populate my list with the data from the server we need to actually specify these

206
00:14:50,360 --> 00:14:51,210
arguments.

207
00:14:51,520 --> 00:14:57,000
And now as you can see here we have this Smurfit right populate view.

208
00:14:57,040 --> 00:15:03,600
So let's actually go inside the curly braces of the Smurfette And now here I can just say.

209
00:15:03,610 --> 00:15:09,880
So first of all as you can see this method populates you actually accepts free arguments the first argument

210
00:15:09,910 --> 00:15:11,690
is actually of type view.

211
00:15:11,740 --> 00:15:11,970
Right.

212
00:15:11,980 --> 00:15:13,980
And the name of this argument is v.

213
00:15:14,020 --> 00:15:16,540
So we can get you to change this name to view right.

214
00:15:16,870 --> 00:15:21,630
And the second argument is actually of the hype object and the name is modeled.

215
00:15:21,730 --> 00:15:26,080
So this uptakes is going to be the object that we receive from the server.

216
00:15:26,110 --> 00:15:28,550
I mean but at the box it objects.

217
00:15:28,660 --> 00:15:30,370
And here we have this position.

218
00:15:30,370 --> 00:15:34,600
So this position is going to specify the position of our object in say the least.

219
00:15:34,600 --> 00:15:41,010
View for example our first object is going to be inside the position 0 or our second object it be inside

220
00:15:41,070 --> 00:15:42,500
the position number 1.

221
00:15:42,670 --> 00:15:50,200
So here inside the Smurfette I can actually say let's actually put a pair of Prentice's here and now

222
00:15:51,130 --> 00:15:53,200
I can actually cast this view.

223
00:15:53,200 --> 00:15:59,150
So as you can see here this view is actually they view the cell that specific cell that we have inside

224
00:15:59,150 --> 00:15:59,840
the list view.

225
00:15:59,860 --> 00:16:02,240
So now let me show you the activity underlying minute example.

226
00:16:02,240 --> 00:16:04,810
So for example we have this item Vonne here.

227
00:16:04,990 --> 00:16:06,350
We have asked him to or we have.

228
00:16:06,390 --> 00:16:12,590
Item 3 this item 1 is actually of view this item do is view this item free is our view.

229
00:16:12,700 --> 00:16:13,320
Right.

230
00:16:13,450 --> 00:16:19,900
So now when I say view I mean one of these cells one of these of actually the items.

231
00:16:19,930 --> 00:16:23,640
So main activity that of up and here listen to the chest.

232
00:16:23,650 --> 00:16:27,130
One of these items or views to our hexed view.

233
00:16:27,400 --> 00:16:27,830
Right.

234
00:16:27,940 --> 00:16:33,530
So inside Apprentice's just put another practices here another pair of practices and here just typing

235
00:16:33,580 --> 00:16:37,140
text view takes you.

236
00:16:37,580 --> 00:16:41,590
And here I am actually casting this view to actually a taste.

237
00:16:41,590 --> 00:16:41,960
You're right.

238
00:16:41,960 --> 00:16:47,190
And here I can see a view but find view by ID.

239
00:16:47,210 --> 00:16:53,780
So now I am saying that view that's fine by you I'm going to go inside this item right inside the cell

240
00:16:53,780 --> 00:16:55,110
or inside this item.

241
00:16:55,250 --> 00:16:57,120
It is actually called a view right.

242
00:16:57,260 --> 00:17:00,080
And I want to get this item one text right.

243
00:17:00,080 --> 00:17:02,320
Not the sub template.

244
00:17:02,320 --> 00:17:13,580
I want to actually get this item on text so now I can say view that fine view by ID or dot ID dot text

245
00:17:13,730 --> 00:17:15,630
one right.

246
00:17:15,650 --> 00:17:17,290
Or that I did a text one.

247
00:17:17,330 --> 00:17:24,260
So it's better to put the android that are that ID that text one because this takes one is actually

248
00:17:24,260 --> 00:17:25,940
inside the Android package.

249
00:17:25,940 --> 00:17:30,080
So Android that are that Id dot text one.

250
00:17:30,230 --> 00:17:34,280
And here we have this actually text view.

251
00:17:34,640 --> 00:17:38,990
And here I can say as you can see I actually cast this object to a text view object.

252
00:17:39,110 --> 00:17:43,670
So here after the end prentices I can't say that said text.

253
00:17:43,700 --> 00:17:47,480
So here we received the box that object he had as the model right.

254
00:17:47,480 --> 00:17:54,090
So here I can say model that gets as you can see here.

255
00:17:54,120 --> 00:17:57,720
Now want to actually for example get the Buxar name right.

256
00:17:57,730 --> 00:18:03,060
So let me show you the web browser as you can see if you have a name named punch power and punch speed.

257
00:18:03,140 --> 00:18:07,840
And this model this object is actually the optic that we receive from the server.

258
00:18:07,850 --> 00:18:16,220
So how come that we cannot actually access the box or name because we are not specific enough to access

259
00:18:16,220 --> 00:18:17,140
that box that object.

260
00:18:17,150 --> 00:18:18,580
You are just saying that object.

261
00:18:18,620 --> 00:18:19,150
Right.

262
00:18:19,340 --> 00:18:26,720
But as I told you in the Java section of the Course all classes in Java are actually a subclass of the

263
00:18:26,720 --> 00:18:27,780
object class.

264
00:18:27,830 --> 00:18:28,310
Right.

265
00:18:28,310 --> 00:18:31,300
For example here we have this box of class right.

266
00:18:31,310 --> 00:18:35,610
This box of class is actually a subclass of the object class.

267
00:18:35,670 --> 00:18:42,650
So inside is an activity class we can't just say model that get boxer named because this object is actually

268
00:18:42,650 --> 00:18:44,530
the superclass of the boxer.

269
00:18:44,630 --> 00:18:45,460
Right.

270
00:18:45,530 --> 00:18:51,950
So I mean now we need to be a little bit more specific we need to specify that the object that we are

271
00:18:51,950 --> 00:18:55,310
getting from the server is actually a box that object.

272
00:18:55,310 --> 00:18:56,570
This is really important.

273
00:18:56,660 --> 00:18:57,610
So how we can do that.

274
00:18:57,610 --> 00:18:59,940
First of all let's scroll to the top here.

275
00:18:59,960 --> 00:19:06,770
As you can see when I actually declared this rowdier firebase that after here after the name of this

276
00:19:06,770 --> 00:19:15,060
class here I can put a pair of angle brackets here as you can see and here I can't say Buxar right.

277
00:19:15,080 --> 00:19:21,110
So in this way I am saying that the object that we want to get from the server is going to be of type

278
00:19:21,340 --> 00:19:22,970
box class.

279
00:19:23,180 --> 00:19:29,510
And if you scroll down here now as you can see less actually change as you can see we have the right

280
00:19:29,840 --> 00:19:32,610
literature to change this object to Boxer.

281
00:19:32,630 --> 00:19:34,250
And here we have this letter.

282
00:19:34,460 --> 00:19:35,420
Right.

283
00:19:35,450 --> 00:19:42,650
It says that class and NMC class did died from a fire baseless after must either be declared abstract

284
00:19:43,070 --> 00:19:46,520
or implement abstract Meffert populate view.

285
00:19:46,760 --> 00:19:47,640
Right.

286
00:19:48,020 --> 00:19:55,430
So now let's actually after the name of this class new firebase listed after here you can actually put

287
00:19:55,700 --> 00:19:57,400
a pair of angle brackets.

288
00:19:57,410 --> 00:20:00,780
And here you can see Buxar.

289
00:20:00,990 --> 00:20:03,910
And now as you can see here the error is gone.

290
00:20:04,230 --> 00:20:04,700
Right.

291
00:20:04,860 --> 00:20:09,670
And here I can see a model that gets Boxtel name.

292
00:20:09,780 --> 00:20:12,550
So in this way we don't get any errors.

293
00:20:12,630 --> 00:20:17,200
And as you can see here I just put a pair of angle brackets after the name of this class.

294
00:20:17,250 --> 00:20:22,650
So new fighter basically said after an inside the angle brackets I specified that the object that that

295
00:20:22,810 --> 00:20:29,500
you are going to receive from the server is going to be of type Buxar class not object boxer right.

296
00:20:29,540 --> 00:20:36,600
And here we actually specify the arguments and now we actually have this populist view.

297
00:20:36,930 --> 00:20:41,460
So this populates buma if it accepts free arguments the first one is the view.

298
00:20:41,460 --> 00:20:44,240
So I told you that the view is one of these cells.

299
00:20:44,310 --> 00:20:45,090
Right.

300
00:20:45,240 --> 00:20:47,210
And it bugs that object.

301
00:20:47,220 --> 00:20:48,570
So this is the model.

302
00:20:48,570 --> 00:20:56,500
This is the data that we want to receive from the server and populate our view with those data objects.

303
00:20:56,580 --> 00:21:00,630
And here we have this position the position of an uptick in say the list view.

304
00:21:00,720 --> 00:21:01,370
Right.

305
00:21:01,410 --> 00:21:08,580
And here inside the populates you Smurfette are first of all of actually cast that we actually created

306
00:21:08,630 --> 00:21:09,570
an object.

307
00:21:09,570 --> 00:21:13,120
For example we are actually referring to the text 1.

308
00:21:13,140 --> 00:21:16,330
So now let me show you the activity underlayment example.

309
00:21:16,440 --> 00:21:17,340
So this takes one.

310
00:21:17,340 --> 00:21:18,140
Here is this.

311
00:21:18,150 --> 00:21:20,970
Item 1 for example or this item 2.

312
00:21:20,970 --> 00:21:25,580
So when I say text 1 I am referring to that specific text.

313
00:21:25,690 --> 00:21:32,490
So we all view refers to that cell to that view that find you this is going to go inside that view and

314
00:21:32,490 --> 00:21:37,900
it's going to find a view or a text view actually inside that view.

315
00:21:38,130 --> 00:21:42,150
And here or so I told you that takes you is actually a subclass of view.

316
00:21:42,210 --> 00:21:45,750
So this means that takes few is actually of view right.

317
00:21:45,900 --> 00:21:48,670
And that's why it says find view by ID.

318
00:21:49,050 --> 00:21:53,780
And inside the apprentice's I am referring to the text on Android that are the ID that takes one.

319
00:21:53,790 --> 00:21:57,490
So this takes one here is actually already created for us.

320
00:21:57,600 --> 00:21:58,330
Right.

321
00:21:58,470 --> 00:22:05,630
And here after the end prentices I am saying that Datsik text I am referring inside the Prentice's I

322
00:22:05,630 --> 00:22:13,160
am referring to this model which is Buxar object of Buxar class model that get Poch surname.

323
00:22:13,170 --> 00:22:19,710
So in this way we can actually get the box uname and we can get the Pogson name of each object of that

324
00:22:19,710 --> 00:22:21,040
we have inside the server.

325
00:22:21,090 --> 00:22:26,850
As you can see here we can get a box in name of each object and we can populate of our list view with

326
00:22:26,850 --> 00:22:28,760
that specific box name.

327
00:22:28,980 --> 00:22:31,950
So let's actually run our project and see what happens.

328
00:22:31,950 --> 00:22:38,040
So now as you can see here our application is actually running on the simulator and TV can not see that

329
00:22:38,040 --> 00:22:38,550
data.

330
00:22:38,580 --> 00:22:44,110
We cannot see the data that we receive from the server and we cannot see that list view.

331
00:22:44,430 --> 00:22:46,580
So let's solve this problem.

332
00:22:46,740 --> 00:22:55,740
So we actually forgot to do something very important right after using the adapter after populating

333
00:22:55,950 --> 00:23:00,850
our view with the boxer name right after these lines of code.

334
00:23:01,040 --> 00:23:07,620
We need to say that as you can see if we have firebase list it after what I told you did fire up baseless

335
00:23:07,710 --> 00:23:11,490
adapter is going to actually populate our list view.

336
00:23:11,610 --> 00:23:12,130
We did.

337
00:23:12,150 --> 00:23:14,710
They thought that we receive from the server.

338
00:23:14,790 --> 00:23:15,550
Right.

339
00:23:15,630 --> 00:23:22,660
So now we need to actually connect our list adapter our firebase adapter to our list view.

340
00:23:22,920 --> 00:23:25,470
And that's why we cannot see up the list.

341
00:23:25,500 --> 00:23:29,190
We cannot see the list that is populated with the data from the server.

342
00:23:29,220 --> 00:23:35,220
So how we can actually connect our list view of it fire basically said Apter.

343
00:23:35,280 --> 00:23:41,720
So here I can say after the end Incra liberal brace of this adapter and before the curly brace of the

344
00:23:41,720 --> 00:23:48,810
Smurfette uncreate Mefford Enceladus uncreate create Meffert I can't say list view that set adapter

345
00:23:49,830 --> 00:23:53,420
firebase Lisa adapter so this is very important.

346
00:23:53,580 --> 00:23:58,600
This line of code here is really important and if I run my project here let's see what happens.

347
00:23:58,650 --> 00:24:00,140
Let me show you.

348
00:24:00,450 --> 00:24:02,840
As you can see our application crashed.

349
00:24:03,090 --> 00:24:03,490
Right.

350
00:24:03,540 --> 00:24:08,180
So now we need to actually debug our application our application has a park.

351
00:24:08,340 --> 00:24:13,080
So I told you that you need to go to the Android studio and at the bottom you just need to click on

352
00:24:13,080 --> 00:24:14,490
this android monitor.

353
00:24:14,550 --> 00:24:15,100
Right.

354
00:24:15,330 --> 00:24:17,730
And now that let me make this area wider.

355
00:24:17,790 --> 00:24:23,800
And I told you you have to actually look at the fatal exception here and here it says Jarba that land

356
00:24:23,800 --> 00:24:29,170
at runtime exception unable to start activity component in info.

357
00:24:29,310 --> 00:24:34,470
And this is actually scroll to the right and it says conduct Google that firebase that database that

358
00:24:34,470 --> 00:24:42,480
database exception calls to set persistence enabled must be made before any other usage of firebase

359
00:24:42,480 --> 00:24:44,100
database instance.

360
00:24:44,110 --> 00:24:48,860
So now let's actually go to our Android studio.

361
00:24:49,020 --> 00:24:50,810
Let's look at these lines of code here.

362
00:24:50,820 --> 00:24:56,420
So this error again is actually related to the Smurfette said persistence in a belt.

363
00:24:56,640 --> 00:25:02,470
And as you can see first we actually are declared art valuable insight is an activity class firebase

364
00:25:02,470 --> 00:25:03,830
database database.

365
00:25:03,940 --> 00:25:11,920
So it says that of first this line of code here is going to be executed before any other usage of firebase

366
00:25:11,920 --> 00:25:13,130
database instance.

367
00:25:13,360 --> 00:25:19,330
So let's actually are in-line number 18 as you can see when we actually declared our firebase database

368
00:25:19,330 --> 00:25:20,070
here.

369
00:25:20,120 --> 00:25:25,790
Let's actually did it this line of code here and here let's go inside this uncreate Mefford and here.

370
00:25:25,900 --> 00:25:32,590
And before this database I can say firebase database so this means that are actually creating this instance

371
00:25:32,620 --> 00:25:33,450
here.

372
00:25:33,880 --> 00:25:35,400
So let's run our project again.

373
00:25:35,410 --> 00:25:41,530
So now as you can see here our application is actually running on the simulator and we are actually

374
00:25:41,530 --> 00:25:44,630
successfully receiving this data from the server.

375
00:25:44,770 --> 00:25:46,930
So now let me show you the web browser as you can see here.

376
00:25:46,930 --> 00:25:49,320
These are the data that we are receiving from the Sarette.

377
00:25:49,320 --> 00:25:51,840
These are the box set objects right.

378
00:25:52,090 --> 00:25:55,570
And here we can see that we are getting the name of the box at Potulny.

379
00:25:55,660 --> 00:26:01,820
So the first one is a the second box it is B again the first box it is be and you can see the box and

380
00:26:01,810 --> 00:26:02,710
then here again is.

381
00:26:02,710 --> 00:26:09,790
So we are receiving this data from the server and we are actually populating our list view of the data

382
00:26:09,850 --> 00:26:11,460
that we receive from the server.

383
00:26:11,530 --> 00:26:17,440
So this is how we can actually populate your view of that box that objects that you receive from the

384
00:26:17,440 --> 00:26:18,020
server.

385
00:26:18,310 --> 00:26:22,530
So for example I want to actually also get the punch power and the punch speed.

386
00:26:22,540 --> 00:26:24,320
So let's go to Android studio.

387
00:26:24,390 --> 00:26:28,740
And now we can actually as you can see we have this adapter right.

388
00:26:28,780 --> 00:26:34,780
And when we are actually initializing our adapter as you can see here we specified the layout right.

389
00:26:34,810 --> 00:26:38,740
Android that are that out that simple list item 1.

390
00:26:38,860 --> 00:26:40,500
So we can get you to change the layout.

391
00:26:40,510 --> 00:26:42,450
So this actually did it this way out.

392
00:26:42,640 --> 00:26:50,220
And here I can't say Android that are that the layout got to line list item right.

393
00:26:50,230 --> 00:26:57,690
To this I lay out in that line this idea and now here we can actually say it takes you view that's fine

394
00:26:57,700 --> 00:27:05,170
view by the Android that are that ideal that takes one that said hexed model that does get Boxer name

395
00:27:05,470 --> 00:27:09,290
and he had inside Apprentice's I can actually use a plus operator.

396
00:27:09,610 --> 00:27:14,480
And then here I can say I can put two double quotes right.

397
00:27:14,650 --> 00:27:17,980
I can actually put a dash right.

398
00:27:18,100 --> 00:27:20,060
So let me actually the appropriate space.

399
00:27:20,170 --> 00:27:25,660
And after two after these double quotes I can actually put another plus the operator.

400
00:27:25,840 --> 00:27:31,990
And here again I can't say model that get a punch power plus.

401
00:27:32,470 --> 00:27:41,960
And then again if I can put two double quotes dash plus model that get punch speed.

402
00:27:42,370 --> 00:27:48,330
So in this way we can actually also output these values to the screen.

403
00:27:48,460 --> 00:27:54,490
So let me actually create a new line here and now you can see this when you hear better.

404
00:27:54,610 --> 00:27:58,130
So we have a text view as you can see and we are setting the text.

405
00:27:58,360 --> 00:28:04,870
And here we are same but model that kickboxer named dash model that gives punch power dash models that

406
00:28:04,870 --> 00:28:06,150
get punch speed.

407
00:28:06,160 --> 00:28:08,020
So let's run our project now.

408
00:28:08,170 --> 00:28:15,310
So I remember that first we actually change the tele out and then we actually put these other values

409
00:28:15,310 --> 00:28:15,760
here.

410
00:28:15,790 --> 00:28:16,680
Right.

411
00:28:16,690 --> 00:28:18,130
So let's run our project again.

412
00:28:18,130 --> 00:28:22,160
So now as you can see here I actually got the data from the server.

413
00:28:22,360 --> 00:28:23,130
Right.

414
00:28:23,190 --> 00:28:26,440
And now we can see this data a 100 200.

415
00:28:26,440 --> 00:28:30,640
So now let me show you the web browser and let me show you the emulator for example.

416
00:28:30,640 --> 00:28:34,080
This is the box and aim is a punch power it's 108.

417
00:28:34,180 --> 00:28:36,260
And the punch speed is 200.

418
00:28:36,280 --> 00:28:41,180
So this is how he can actually work with the firebase list adapter.

419
00:28:41,350 --> 00:28:47,170
And this is how he can populate this view with the data that you can actually receive from the server.

420
00:28:47,290 --> 00:28:47,590
Right.

421
00:28:47,590 --> 00:28:48,900
So these are the data.

422
00:28:49,300 --> 00:28:52,380
So I think that's enough for this Tauriel.

423
00:28:52,420 --> 00:28:58,030
So if you have any questions please post the discussion in the course and then I'll do my best to answer

424
00:28:58,060 --> 00:28:59,340
all of your questions.

425
00:28:59,350 --> 00:29:02,750
Thank you very much for watching and I'll see you in the next year or two earlier.

