1
00:00:00,600 --> 00:00:05,580
So it's actually to go back and say to me an activity that I will fight here and as you can see I actually

2
00:00:05,580 --> 00:00:08,150
instantiated this object in 9:19.

3
00:00:08,160 --> 00:00:11,470
So now it's actually to create a class called al-Ahmad.

4
00:00:11,540 --> 00:00:16,740
OK so just click on this find new and then click on double class.

5
00:00:16,740 --> 00:00:22,080
So here for the name of your class just type in here and on and then click on OK.

6
00:00:22,350 --> 00:00:28,770
So here I want to actually put in the variables or the misfits that are only specific to these Animal

7
00:00:28,770 --> 00:00:29,430
class.

8
00:00:29,430 --> 00:00:33,210
So now let's actually track some images into our project.

9
00:00:33,210 --> 00:00:33,750
OK.

10
00:00:33,990 --> 00:00:42,480
So here as you can see we have these tribal folder inside of his folder here so I can just copy these

11
00:00:42,480 --> 00:00:44,570
images that are on my desktop.

12
00:00:44,580 --> 00:00:45,180
OK.

13
00:00:45,420 --> 00:00:47,560
And then I can just select is triable for that.

14
00:00:47,610 --> 00:00:50,730
And then I can just paste them here and then click on OK.

15
00:00:50,840 --> 00:00:51,540
OK.

16
00:00:52,080 --> 00:00:57,240
So now I have these images and here I want to actually put in some lines of code and then I'm going

17
00:00:57,240 --> 00:00:58,920
to explain to you what's going on here.

18
00:00:58,920 --> 00:01:04,550
So as you can see here these are the lines of code that they actually pasted inside of this Animal class.

19
00:01:04,590 --> 00:01:12,600
Ok so first of all I actually created an alley of integer values animal images and I actually declared

20
00:01:12,660 --> 00:01:15,660
this at a as an aesthetic value.

21
00:01:15,870 --> 00:01:23,250
So as you can see here the reason that I actually put this static keyboard here is that I can actually

22
00:01:23,730 --> 00:01:31,050
access these variables these arrays without creating an object from this animal class.

23
00:01:31,050 --> 00:01:37,200
So for example inside this main activity the java file if you want to actually access these are animal

24
00:01:37,290 --> 00:01:37,670
images.

25
00:01:37,670 --> 00:01:45,360
Arii I can access that array by just referring to this animal class that animal image is OK without

26
00:01:45,390 --> 00:01:47,990
creating an object from the Animal class.

27
00:01:48,090 --> 00:01:52,190
So that's the reason that I actually put that static keyboard here.

28
00:01:52,260 --> 00:01:53,050
OK.

29
00:01:53,370 --> 00:01:54,980
So this is very important.

30
00:01:55,200 --> 00:01:58,920
And here I created an array of integer values as you can see animal images.

31
00:01:58,950 --> 00:02:04,100
And these are the ideas of the resources of my images in our application.

32
00:02:04,140 --> 00:02:09,990
In our project as you can see these are the images inside the tribal folder and these are the animal

33
00:02:09,990 --> 00:02:10,610
names.

34
00:02:10,630 --> 00:02:13,930
Ari this is the type of these are a string.

35
00:02:14,040 --> 00:02:15,420
And we can see these values.

36
00:02:15,630 --> 00:02:17,030
And again this is static.

37
00:02:17,070 --> 00:02:17,410
OK.

38
00:02:17,520 --> 00:02:23,550
So I can access these areas without creating an object from this animal class.

39
00:02:23,570 --> 00:02:30,370
OK so now let's actually create another class called Galili adapter.

40
00:02:30,390 --> 00:02:30,930
OK.

41
00:02:31,020 --> 00:02:35,780
So I just need to click on this file new and then click on Java class.

42
00:02:36,060 --> 00:02:43,890
So here for the name of your class just type in here a gallery adapter and then click on OK.

43
00:02:44,100 --> 00:02:48,350
So here as you can see inside these jobs there you have these classes here.

44
00:02:48,390 --> 00:02:49,130
OK.

45
00:02:49,260 --> 00:02:54,970
So I just need to double click on the tab so that this area this editor area is now much wider.

46
00:02:54,990 --> 00:03:01,620
So now if we want to actually implement the gallery in our project we need to actually to extend from

47
00:03:01,620 --> 00:03:04,080
the base adapter class.

48
00:03:04,080 --> 00:03:06,870
OK so base adapter.

49
00:03:07,050 --> 00:03:14,220
Here as you can see of we need to actually implement the right the actually the inherited methods that

50
00:03:14,220 --> 00:03:16,930
you actually inherit from these spaces after class.

51
00:03:16,950 --> 00:03:20,320
So here Argenta us right clicking is Gallery.

52
00:03:20,360 --> 00:03:22,730
After our class generates.

53
00:03:23,010 --> 00:03:23,580
OK.

54
00:03:23,730 --> 00:03:25,750
And then we can implement MFX.

55
00:03:25,770 --> 00:03:30,690
So as you can see here these are the methods that we that we need to actually implement in our gallery

56
00:03:30,740 --> 00:03:31,670
after class.

57
00:03:31,680 --> 00:03:32,090
OK.

58
00:03:32,190 --> 00:03:34,360
So I just need to click on OK.

59
00:03:34,800 --> 00:03:35,980
And these are the methods.

60
00:03:36,120 --> 00:03:42,310
OK so first let's actually put in some lines of code here and then we can actually go go ahead and putting

61
00:03:42,690 --> 00:03:45,270
our own implementations inside of these methods.

62
00:03:45,270 --> 00:03:52,560
So inside of this gallery adapter class let's actually declare an instance variable context OK context

63
00:03:52,940 --> 00:03:53,800
semicolon.

64
00:03:53,910 --> 00:03:59,880
And here I need to actually create a constructor for this Galeria after class so I can just type in

65
00:04:00,120 --> 00:04:00,830
public.

66
00:04:00,900 --> 00:04:01,540
OK.

67
00:04:01,710 --> 00:04:06,650
And the name of my constructor must be the same as the name of my class Galeria adapter.

68
00:04:06,730 --> 00:04:13,940
And here inside Apprentice's I can just typing Kunst context.

69
00:04:14,000 --> 00:04:15,080
OK context.

70
00:04:15,230 --> 00:04:15,820
OK.

71
00:04:16,060 --> 00:04:21,900
And I need to actually open the open and close this constructor by using the curly braces.

72
00:04:21,930 --> 00:04:27,560
So here I need to actually initialize my context that actually created in inline 40.

73
00:04:27,680 --> 00:04:30,750
Ok so I can't just refer to the name of this context.

74
00:04:30,780 --> 00:04:37,270
So as you can see here as I actually typed in context this context actually refers to this context argument.

75
00:04:37,290 --> 00:04:41,020
OK so here I just need to put in these dots Cuber.

76
00:04:41,070 --> 00:04:43,000
OK this that context.

77
00:04:43,050 --> 00:04:46,730
Now it is actually referring to this instance variable.

78
00:04:46,740 --> 00:04:51,460
Ok this is the context assignment operator context.

79
00:04:51,570 --> 00:04:52,450
OK.

80
00:04:52,620 --> 00:04:54,550
So hopefully that makes sense.

81
00:04:54,600 --> 00:05:00,690
And now let's actually put in our own implementations inside these it misfits.

82
00:05:00,700 --> 00:05:01,080
OK.

83
00:05:01,120 --> 00:05:04,910
So as you can see here this is the Get count counterfeit.

84
00:05:04,990 --> 00:05:05,630
OK.

85
00:05:05,830 --> 00:05:11,680
And here we need to actually return the number of elements that are actually inside our at.

86
00:05:11,710 --> 00:05:18,280
So as you can see here inside of this gallery or after class we don't have any Arey here and we actually

87
00:05:18,280 --> 00:05:21,450
declared our arrays inside of these animal class.

88
00:05:21,600 --> 00:05:22,180
OK.

89
00:05:22,420 --> 00:05:25,360
And these arrays are actually declared static.

90
00:05:25,450 --> 00:05:29,670
So we can actually use these areas without creating an object.

91
00:05:29,710 --> 00:05:30,310
OK.

92
00:05:30,370 --> 00:05:32,980
From these animal class.

93
00:05:33,020 --> 00:05:38,030
So inside this gallery after class here for this I get counter benefit.

94
00:05:38,050 --> 00:05:42,330
I can just refer to the name of this animal class animal.

95
00:05:42,870 --> 00:05:43,640
OK.

96
00:05:43,870 --> 00:05:47,770
That's our animal images thought Lynn.

97
00:05:48,190 --> 00:05:48,950
OK.

98
00:05:48,970 --> 00:05:52,720
So now I am actually returning the length of these animal images.

99
00:05:52,810 --> 00:05:53,820
Aure OK.

100
00:05:54,040 --> 00:05:55,540
And here we need to actually return.

101
00:05:55,550 --> 00:05:59,830
Are there specific objects that are actually inside of or for example this Ari.

102
00:05:59,920 --> 00:06:00,360
OK.

103
00:06:00,430 --> 00:06:08,500
So for this get item Meffert I can actually do return to this animal class that animal images Suppe

104
00:06:08,560 --> 00:06:09,490
position.

105
00:06:09,840 --> 00:06:10,620
OK.

106
00:06:11,140 --> 00:06:15,990
And here we need to actually turn the ID of odd objects.

107
00:06:16,000 --> 00:06:22,920
So the idea would be that position OK the index of the indexes that are actually inside of our array.

108
00:06:22,930 --> 00:06:24,920
For example this anyone who may.

109
00:06:25,330 --> 00:06:31,330
And here we need to actually put in our own implementation inside of this Gates view method.

110
00:06:31,360 --> 00:06:31,960
OK.

111
00:06:32,260 --> 00:06:36,060
So let's actually change these arguments name to view.

112
00:06:36,280 --> 00:06:41,200
And now I'm going to actually pasting some lines of code here and then I'm going to explain to you what's

113
00:06:41,200 --> 00:06:42,130
going on here.

114
00:06:42,190 --> 00:06:46,620
So as you can see here these are the lines of code that they actually pasted here.

115
00:06:46,630 --> 00:06:51,000
So first about in 9:43 I created an image view object.

116
00:06:51,010 --> 00:06:51,640
OK.

117
00:06:51,880 --> 00:06:59,290
And then here I specify the context for this constructed of this image view and in line of 44 I actually

118
00:06:59,290 --> 00:07:01,110
called our method on this image.

119
00:07:01,210 --> 00:07:03,520
So I interviewed that set image resource.

120
00:07:03,520 --> 00:07:03,990
OK.

121
00:07:04,090 --> 00:07:11,940
So I want to actually set up an image to this image view animal that animal images are supposition.

122
00:07:12,150 --> 00:07:12,680
OK.

123
00:07:12,910 --> 00:07:19,270
So here it's going to be assigned those images to this image view and then in line forty five as you

124
00:07:19,270 --> 00:07:21,970
can see IMJ view that set level perhaps.

125
00:07:21,970 --> 00:07:27,970
So here I want to actually specify the width and height of my images inside the actually inside the

126
00:07:27,970 --> 00:07:28,550
Gelati.

127
00:07:28,630 --> 00:07:35,500
OK so I'll give you that certainly and perhaps an inside the apprentice's new as you can see I put this

128
00:07:35,560 --> 00:07:37,260
new viewport gallery.

129
00:07:37,270 --> 00:07:42,970
So because my images are going to be inside the gelati I need to refer to this gallery here.

130
00:07:42,970 --> 00:07:43,970
This is the parent.

131
00:07:44,050 --> 00:07:44,570
OK.

132
00:07:44,740 --> 00:07:52,670
This is the Pallant of my image views that lay out the palms of 1000 for the left feet for my image.

133
00:07:52,840 --> 00:07:56,000
And 1040s image view height.

134
00:07:56,020 --> 00:07:56,790
OK.

135
00:07:57,180 --> 00:08:01,540
And 9:46 I actually referred to this image again.

136
00:08:01,570 --> 00:08:03,930
I interviewed that set padding here.

137
00:08:03,940 --> 00:08:10,900
I want to actually specify the paddings of my image view of one for the lift one hundred for the top

138
00:08:11,230 --> 00:08:15,630
100 for the right and 100 for the actually the bottom.

139
00:08:15,670 --> 00:08:16,300
OK.

140
00:08:16,510 --> 00:08:19,450
And here I am actually returning this image view return.

141
00:08:19,450 --> 00:08:20,130
I can give you.

142
00:08:20,170 --> 00:08:21,130
OK.

143
00:08:21,430 --> 00:08:27,010
So now let's actually go back inside this main activity that double fight here and now let's actually

144
00:08:27,010 --> 00:08:30,600
create an object from this Gellatly that after after class.

145
00:08:30,670 --> 00:08:34,430
So if Galerie adapter adapter assignments.

146
00:08:34,540 --> 00:08:41,650
Operator new Gallerie adapter and here are I need to actually specify the context for the constructor

147
00:08:41,650 --> 00:08:45,820
of this Gellatly after class as you can see here we have this constructor here.

148
00:08:45,820 --> 00:08:50,220
So the context would be main activity that this.

149
00:08:50,370 --> 00:08:52,950
So this is the context the name of our class.

150
00:08:52,960 --> 00:08:53,690
OK.

151
00:08:53,900 --> 00:08:58,350
And now I need to actually refer to the name of this gelati object as you can see here.

152
00:08:58,510 --> 00:09:07,520
So again the dot sets adapter as you can see here and here I need to put in the adapter here.

153
00:09:07,550 --> 00:09:08,860
OK adapter.

154
00:09:09,220 --> 00:09:12,220
And now let's actually run our project and see what happens.

155
00:09:12,250 --> 00:09:18,760
So as you can see here our application is actually running on this emulator and it says these are our

156
00:09:18,760 --> 00:09:22,210
animals images inside the gallery.

157
00:09:22,390 --> 00:09:23,290
OK.

158
00:09:23,350 --> 00:09:28,240
And as you can see here this is our image and if they actually scroll to the left I can see the other

159
00:09:28,240 --> 00:09:29,190
image is OK.

160
00:09:29,350 --> 00:09:32,150
And these images are actually inside the gallery OK.

161
00:09:32,380 --> 00:09:36,120
And if you scroll to the left I can see the other images here.

162
00:09:36,220 --> 00:09:37,380
OK.

163
00:09:38,050 --> 00:09:40,230
So hopefully that makes sense.

164
00:09:40,300 --> 00:09:46,810
And now let's actually as you can see we need to actually put putting our own images inside a horizontal

165
00:09:46,810 --> 00:09:47,240
scroll.

166
00:09:47,250 --> 00:09:47,540
OK.

167
00:09:47,560 --> 00:09:51,890
These are our animal images inside the horizontal scroll view.

168
00:09:52,180 --> 00:09:55,720
So now let's actually go back to our main activity the double fight here.

