1
00:00:00,150 --> 00:00:04,540
So here let's actually go back and say discrete beauty at the java file here.

2
00:00:04,800 --> 00:00:08,670
Now I'm going actually pasting some lines of code and then I'm going to explain to you what's going

3
00:00:08,670 --> 00:00:09,260
on here.

4
00:00:09,270 --> 00:00:13,610
So as you can see here these are the lines of code that I actually pasted here.

5
00:00:13,620 --> 00:00:19,230
So first of all I created an array of integer values as you can see here the name of this art is animate

6
00:00:19,260 --> 00:00:20,040
images.

7
00:00:20,070 --> 00:00:26,400
So here I am actually referring to the ID of my image inside these tribal Forder as you can see inside

8
00:00:26,460 --> 00:00:28,540
our project we have this tribal folder.

9
00:00:28,560 --> 00:00:33,930
So I just referred to the idea of these images as you can see are that triable that bear and the other

10
00:00:33,930 --> 00:00:38,640
images and you have an arrow of string values as you can see here.

11
00:00:38,640 --> 00:00:44,090
So here I actually signed the name of odd animals to this Aure animal names.

12
00:00:44,340 --> 00:00:44,820
OK.

13
00:00:45,000 --> 00:00:48,840
So now let's actually create a context.

14
00:00:48,870 --> 00:00:51,100
OK so context context.

15
00:00:51,210 --> 00:00:57,600
So here I just want to declare this context object and noun texturally create a constructor for this

16
00:00:57,830 --> 00:01:03,090
great view adapter class so I can just type in public view adapter.

17
00:01:03,120 --> 00:01:07,360
So the name of your constructor must be the same as the name of your class.

18
00:01:07,410 --> 00:01:08,010
OK.

19
00:01:08,220 --> 00:01:14,970
And then I need to specify that this constructor actually that accepts an object of type context.

20
00:01:14,970 --> 00:01:23,340
So here I can just type in context context and then here in say that these constructor can actually

21
00:01:24,630 --> 00:01:29,260
initialize these are context objects that are actually declared in line 20.

22
00:01:29,340 --> 00:01:35,520
So here I can just type in this that context assignment operator context.

23
00:01:35,730 --> 00:01:39,810
OK so this context as you can see refers to this instance valuable.

24
00:01:39,930 --> 00:01:42,900
And this context refers to this argument.

25
00:01:42,910 --> 00:01:49,350
OK so now let's actually put in our own implementations inside of these other methods.

26
00:01:49,350 --> 00:01:51,120
So the first effort is good.

27
00:01:51,130 --> 00:01:56,820
Count OK as you can see if it is public the return type of this method is int integer so these Minford

28
00:01:57,020 --> 00:02:01,710
on it's to return a value of type integer and the name of this if it is get count.

29
00:02:01,710 --> 00:02:07,690
So we need to actually return the number of elements that are inside of these for example animal images.

30
00:02:07,700 --> 00:02:08,090
Ari.

31
00:02:08,120 --> 00:02:08,620
OK.

32
00:02:08,910 --> 00:02:15,300
So here I could just return animal images that land.

33
00:02:15,710 --> 00:02:16,430
OK.

34
00:02:16,710 --> 00:02:19,070
And we have here this.

35
00:02:19,100 --> 00:02:23,750
I get either Mefford and this get item if it returns an object.

36
00:02:23,790 --> 00:02:24,240
OK.

37
00:02:24,390 --> 00:02:29,370
So here as you can see it is if it actually accepts an argument of type integer position.

38
00:02:29,370 --> 00:02:35,180
So is this method actually gives us this position the position about items inside of the array.

39
00:02:35,250 --> 00:02:37,280
So here I need to actually to return.

40
00:02:37,300 --> 00:02:41,740
Are there specific values that are for example in say that these animal images.

41
00:02:42,140 --> 00:02:48,420
OK the specific images that are inside of this specific indexes of these Ari OK.

42
00:02:48,690 --> 00:02:57,090
So here in the inside These are get item if I could just 310 these animal images stop position.

43
00:02:57,240 --> 00:03:01,370
So as you can see here we received the position of our animals as an argument.

44
00:03:01,410 --> 00:03:08,850
So we receive the position or the index of our animals inside of these animal images as an argument

45
00:03:08,880 --> 00:03:10,910
to the Smurfit as you can see here.

46
00:03:11,250 --> 00:03:14,710
So here we have this get item ID.

47
00:03:14,790 --> 00:03:22,410
OK so the idea of identity as you can see we receive the index or the position of our values inside

48
00:03:22,410 --> 00:03:23,170
of our arrays.

49
00:03:23,190 --> 00:03:27,870
As you can see for example this animal images are a reason for this value is at index 0.

50
00:03:27,880 --> 00:03:31,410
OK so this would be the ID of our items.

51
00:03:31,410 --> 00:03:34,760
So here I could just return this position as an ID.

52
00:03:34,800 --> 00:03:35,250
OK.

53
00:03:35,290 --> 00:03:36,150
Item ID.

54
00:03:36,150 --> 00:03:38,950
And here we need to actually implement this method.

55
00:03:39,120 --> 00:03:44,940
So it's actually did it this line of code here and here we could actually are putting in our own implementations

56
00:03:44,940 --> 00:03:46,090
inside of this Moffit.

57
00:03:46,260 --> 00:03:47,830
So this is really important.

58
00:03:47,980 --> 00:03:53,040
And this it is going to be called on every iteration of our values.

59
00:03:53,050 --> 00:03:56,330
Inside there are actually the great view.

60
00:03:56,400 --> 00:03:57,090
OK.

61
00:03:57,450 --> 00:04:03,000
So now I'm going to paste in some lines of code here and then I'm going to explain to you what's going

62
00:04:03,000 --> 00:04:03,960
on here.

63
00:04:04,440 --> 00:04:10,190
So as you can see here these are the lines of code that I actually pasted here inside of this method.

64
00:04:10,380 --> 00:04:15,840
So first about in line 50 I actually created an object of type image view.

65
00:04:15,870 --> 00:04:16,340
OK.

66
00:04:16,440 --> 00:04:23,550
And the name of this image is I give you assignment operator and here I am actually instantiating this

67
00:04:23,550 --> 00:04:26,560
object by putting this new keyword image view.

68
00:04:26,700 --> 00:04:31,470
And for the context of this image view class I need to put in this context here.

69
00:04:31,590 --> 00:04:35,270
OK this is required an in line 51.

70
00:04:35,460 --> 00:04:41,480
I actually want to set the image for this image view so IMJ view that seems set image resource.

71
00:04:41,760 --> 00:04:45,800
I want to actually return the image to this MFL.

72
00:04:45,810 --> 00:04:51,360
So I just need to refer to the name of these animal images Arrey as you can see here we have these images

73
00:04:52,770 --> 00:04:55,230
and animal images supposition.

74
00:04:55,320 --> 00:05:00,990
OK so we actually received the position of our animals inside of this Ali an argument to these kids

75
00:05:00,990 --> 00:05:04,010
view Meffert OK animal images supposition.

76
00:05:04,320 --> 00:05:04,820
OK.

77
00:05:04,920 --> 00:05:12,690
So it's going to actually assigned those images to this image of you here and you have this line of

78
00:05:12,690 --> 00:05:13,150
code here.

79
00:05:13,170 --> 00:05:15,300
I can give you that set the layout Department.

80
00:05:15,510 --> 00:05:21,810
So the layout part is actually going to specify the weight and the height of our image views inside

81
00:05:21,840 --> 00:05:22,800
of great view.

82
00:05:22,860 --> 00:05:30,720
As you can see here inside these inside these emulator we can see this great view here and you can see

83
00:05:30,720 --> 00:05:36,170
that the width and height of these image views inside of this great view.

84
00:05:36,300 --> 00:05:36,790
OK.

85
00:05:36,930 --> 00:05:41,190
So here I just inside the Prentice's I put in the new keyboard.

86
00:05:41,190 --> 00:05:41,860
Great view.

87
00:05:41,880 --> 00:05:47,760
So because these images are actually inside of the screen view first when it was actually the to the

88
00:05:47,760 --> 00:05:48,800
name of the parents.

89
00:05:48,810 --> 00:05:49,330
OK.

90
00:05:49,410 --> 00:05:52,180
So the great view is the parent of these images.

91
00:05:52,200 --> 00:05:52,760
OK.

92
00:05:52,830 --> 00:05:56,370
So first I need to refer to the name of this parent or great view.

93
00:05:56,380 --> 00:06:03,790
Ok thought lay out perhaps and then I can actually specify the width and height of my images.

94
00:06:03,810 --> 00:06:04,400
OK.

95
00:06:04,470 --> 00:06:06,050
So this is very important.

96
00:06:06,540 --> 00:06:08,170
And here we have this.

97
00:06:08,190 --> 00:06:10,020
I interviewed that said the padding.

98
00:06:10,080 --> 00:06:14,440
So this is the padding of our images inside of this great view.

99
00:06:14,480 --> 00:06:14,920
OK.

100
00:06:15,120 --> 00:06:22,470
Ten for the left 10 for the top 10 for the right and 10 for the bottom and in line are 54 as you can

101
00:06:22,470 --> 00:06:27,030
see I am specifying the scale type of my image view.

102
00:06:27,070 --> 00:06:34,290
I give you that set scale type image view that said scale type that center crop as you can see here

103
00:06:34,460 --> 00:06:40,610
this image views are actually at the center cropped as you can see here inside of this great view.

104
00:06:41,070 --> 00:06:43,320
And you can actually specify other values too.

105
00:06:43,470 --> 00:06:44,460
OK.

106
00:06:44,790 --> 00:06:54,660
So for example I could just delete this value here and I can just typing image view that SKAIFE type

107
00:06:55,030 --> 00:06:55,850
that.

108
00:06:56,010 --> 00:06:57,920
And here you can specify these values.

109
00:06:58,050 --> 00:06:59,830
For example feats x y.

110
00:06:59,960 --> 00:07:00,660
OK.

111
00:07:01,110 --> 00:07:06,080
And here I actually make these I am making this up.

112
00:07:06,240 --> 00:07:10,180
I m g view object a listener to the clicks of the user.

113
00:07:10,380 --> 00:07:16,200
OK so I can give you as you can see here that sets unclick listener.

114
00:07:16,480 --> 00:07:19,240
OK I interviewed that said Uncle listener.

115
00:07:19,440 --> 00:07:24,210
And as you can see here I am creating an anonymous in a class here.

116
00:07:24,290 --> 00:07:24,610
OK.

117
00:07:24,610 --> 00:07:29,620
Inside of this method inside of it inside of these gates view Meffert.

118
00:07:29,940 --> 00:07:31,920
And here I created a toast.

119
00:07:32,100 --> 00:07:36,600
OK toast that make text first I need to specify the context.

120
00:07:36,660 --> 00:07:37,270
OK.

121
00:07:37,470 --> 00:07:41,420
And then second I need to specify the text that I want to show to the user.

122
00:07:41,490 --> 00:07:44,270
OK the name of the animal is animal image.

123
00:07:44,340 --> 00:07:45,210
Animal names.

124
00:07:45,240 --> 00:07:47,480
So here I referred to these animal names.

125
00:07:47,490 --> 00:07:51,790
Ari as you can see these are a holds are the names of my animals.

126
00:07:51,920 --> 00:07:54,790
Ok animals supposition.

127
00:07:54,870 --> 00:08:00,450
So as you can see if we received the position of our animals as an argument here as you can see.

128
00:08:00,780 --> 00:08:04,510
And here I am specifying the duration of my toast.

129
00:08:04,650 --> 00:08:05,220
OK.

130
00:08:05,400 --> 00:08:07,740
Toss that dotted line short.

131
00:08:07,830 --> 00:08:11,150
And here I am calling them if it's show on this toast.

132
00:08:11,190 --> 00:08:11,820
OK.

133
00:08:12,060 --> 00:08:17,730
So here as you can see it's showing us an error and it says that because we are actually inside of an

134
00:08:17,910 --> 00:08:24,780
inner class and anonymous in a class the this our position valuable disposition argument needs to be

135
00:08:24,780 --> 00:08:25,290
final.

136
00:08:25,340 --> 00:08:25,620
OK.

137
00:08:25,620 --> 00:08:31,460
Valuable position is accessed from within in class needs to be declared final.

138
00:08:31,470 --> 00:08:38,950
So here I could just put in the final keyword here and now as you can see the error is gone.

139
00:08:39,140 --> 00:08:43,320
OK so here I am actually returning this item do you object.

140
00:08:43,320 --> 00:08:48,630
So because this method actually returns an object of type review.

141
00:08:48,840 --> 00:08:54,770
OK we could an image is actually a subclass of view.

142
00:08:54,840 --> 00:08:56,750
We can actually return I interview.

143
00:08:56,910 --> 00:08:57,420
OK.

144
00:08:57,630 --> 00:08:59,910
So here you can see these arguments.

145
00:08:59,920 --> 00:09:02,420
Position view and view group.

146
00:09:02,420 --> 00:09:07,440
So let's actually change the name of this view argument to view here.

147
00:09:07,440 --> 00:09:08,140
OK.

148
00:09:08,670 --> 00:09:14,340
So I think that's enough for this class structure actually to go back and say this main activity of

149
00:09:14,340 --> 00:09:14,960
a file.

150
00:09:15,210 --> 00:09:19,850
And then here let's actually create an object from this great view adapter.

151
00:09:19,860 --> 00:09:27,060
So here I can just type in great view adapter adapter assignment operator new and here again I need

152
00:09:27,060 --> 00:09:30,610
to refer to the name of this great view adapter class.

153
00:09:30,870 --> 00:09:34,970
And here for the constructor of this class I need to specify the context.

154
00:09:35,100 --> 00:09:38,480
So the context is main activity that this.

155
00:09:38,880 --> 00:09:40,290
OK semicolon.

156
00:09:40,530 --> 00:09:43,140
OK the name of this class is the const is the context.

157
00:09:43,140 --> 00:09:43,550
OK.

158
00:09:43,620 --> 00:09:47,930
And here I need to refer to the name of discrete view here as you can see.

159
00:09:48,090 --> 00:09:52,220
So g r the view that sets adapter.

160
00:09:52,620 --> 00:09:53,120
OK.

161
00:09:53,250 --> 00:09:56,540
And here we need to put in the adapter adapter.

162
00:09:56,810 --> 00:09:57,440
OK.

163
00:09:57,450 --> 00:10:00,380
So let's actually run on our project and see what happens.

164
00:10:00,450 --> 00:10:05,660
So here as you can see our application is running on this emulator and this is that takes.

165
00:10:05,670 --> 00:10:08,980
These are the images of our animals in a great view.

166
00:10:09,150 --> 00:10:12,050
And here at the bottom you can see this great view here.

167
00:10:12,060 --> 00:10:12,950
OK.

168
00:10:13,340 --> 00:10:14,320
You can see these images.

169
00:10:14,340 --> 00:10:19,320
And if I click on this image for example it says the name of the animal is bird and if you click on

170
00:10:19,320 --> 00:10:27,090
these fish here the name of the animal is fish or for example this lion the name of the animal is lion

171
00:10:27,180 --> 00:10:30,660
and tiger the name of the animal is Tiger.

172
00:10:31,050 --> 00:10:32,640
So hopefully that makes sense.

173
00:10:32,640 --> 00:10:35,300
And I think that's enough for this theater.

174
00:10:35,490 --> 00:10:40,800
And if you have any questions please post the discussion in the course and then I'll do my best to answer

175
00:10:40,860 --> 00:10:42,050
all of your questions.

176
00:10:42,210 --> 00:10:44,990
Thank you very much for watching and I'll see you in the next year.

177
00:10:45,030 --> 00:10:45,370
Tauriel.

