1
00:00:00,430 --> 00:00:01,020
OK.

2
00:00:01,050 --> 00:00:05,610
So now inside of this main activity class I'm going to actually declare two objects.

3
00:00:05,610 --> 00:00:08,870
So as you can see here these are the lines of code that they actually pasted here.

4
00:00:08,880 --> 00:00:16,110
First of all I actually created an object of type linear layout and the name of this object is linearly

5
00:00:16,110 --> 00:00:17,140
or horizontal.

6
00:00:17,400 --> 00:00:22,710
And I actually created an object of type image view and the name of this object is IMT animal.

7
00:00:22,760 --> 00:00:23,430
OK.

8
00:00:23,550 --> 00:00:29,910
And inside of this uncreate Smurfette I want to actually to instantiate these objects that I actually

9
00:00:29,910 --> 00:00:31,820
declared inside of this class.

10
00:00:31,830 --> 00:00:32,430
OK.

11
00:00:32,640 --> 00:00:37,150
So first of all I want to actually instantiate these linearly at horizontal.

12
00:00:37,170 --> 00:00:40,600
So here I can just type in linearly or horizontal assignments.

13
00:00:40,620 --> 00:00:47,100
Operator And here I need to cast this object to are linearly horizontal linearly out excuse me linearly

14
00:00:47,100 --> 00:00:56,180
out and fight view by ID are that Id dot lenient lay out horizontal.

15
00:00:56,200 --> 00:00:56,990
OK.

16
00:00:57,460 --> 00:00:59,890
And now let's actually instantiate this.

17
00:00:59,910 --> 00:01:01,450
I am animate object.

18
00:01:01,650 --> 00:01:07,230
So here I can just say I am the animal assignment operator and then here I need to test this object

19
00:01:07,230 --> 00:01:09,010
to an image view object.

20
00:01:09,230 --> 00:01:09,910
OK.

21
00:01:10,320 --> 00:01:12,570
Find a view by the artist.

22
00:01:12,630 --> 00:01:15,400
I really thought all UMG anemone.

23
00:01:15,680 --> 00:01:17,950
OK so now.

24
00:01:18,000 --> 00:01:23,820
So now inside of our class I want to actually paste them on their feet here and then I'm going to explain

25
00:01:23,820 --> 00:01:25,000
to you what's going on here.

26
00:01:25,140 --> 00:01:30,890
So after the alien curly brace of these uncreate Meffert Let's actually create a method here.

27
00:01:31,110 --> 00:01:34,410
And as you can see here this is the Meffert that I actually pasted here.

28
00:01:34,410 --> 00:01:41,240
Public void and the name of this method is let's sit lay out palms for image.

29
00:01:41,250 --> 00:01:46,880
So I just need to change this up here to our capital case letter.

30
00:01:46,980 --> 00:01:47,350
OK.

31
00:01:47,370 --> 00:01:50,350
So the access modifier of this method is public.

32
00:01:50,510 --> 00:01:52,490
The return type of this method is void.

33
00:01:52,830 --> 00:01:58,800
And as you can see the name of this method is let's set out perhaps for image view and this and if it

34
00:01:58,800 --> 00:02:01,570
actually exits an object of type image view.

35
00:02:01,700 --> 00:02:01,970
OK.

36
00:02:01,980 --> 00:02:07,730
As you can see and here inside the Meffert I actually referred to this argument image view that sets

37
00:02:07,940 --> 00:02:17,460
out perhaps Miyu linearly out so linear layouts as you can see the parent is a linear layout that lay

38
00:02:17,460 --> 00:02:18,280
out arms.

39
00:02:18,360 --> 00:02:22,700
Ok so here I want to specify the width and height of my image view.

40
00:02:22,860 --> 00:02:26,400
So 1000 for the beat and one of 1000 for the height.

41
00:02:26,400 --> 00:02:27,230
OK.

42
00:02:27,270 --> 00:02:32,490
So here I'm going actually pasting some lines of code here and then I'm going to explain to you what's

43
00:02:32,490 --> 00:02:33,440
going on here.

44
00:02:33,450 --> 00:02:37,990
So as you can see here these are the lines of code that they actually pasted here.

45
00:02:38,070 --> 00:02:38,690
OK.

46
00:02:38,880 --> 00:02:41,600
So now when I should explain to you what this code does here.

47
00:02:41,610 --> 00:02:42,080
OK.

48
00:02:42,240 --> 00:02:45,210
First of all I created a for loop here.

49
00:02:45,240 --> 00:02:45,840
OK.

50
00:02:45,870 --> 00:02:51,660
And inside the Prentice's of this for loop as you can see I created a variable of type integer and the

51
00:02:51,660 --> 00:02:53,750
name of this valuable is index.

52
00:02:53,820 --> 00:02:57,440
And then I assigned a value 0 to this index variable.

53
00:02:57,480 --> 00:02:58,890
This is actually a local value.

54
00:02:58,940 --> 00:02:59,560
OK.

55
00:02:59,910 --> 00:03:06,090
And here I specified the condition of which determines how many times this group is going to be executed.

56
00:03:06,090 --> 00:03:13,260
So until the value of this index variable is less than the value of the length of these animal images

57
00:03:13,350 --> 00:03:17,370
Ari that is inside of this animal class as you can see here.

58
00:03:17,670 --> 00:03:23,640
Then this loop is going to be executed and after each execution of this for a loop the value of this

59
00:03:23,700 --> 00:03:26,690
index variable is going to be incremented by 1.

60
00:03:26,700 --> 00:03:28,750
So inside of this for loop.

61
00:03:28,800 --> 00:03:31,360
First of all I created a constant.

62
00:03:31,440 --> 00:03:32,030
OK.

63
00:03:32,190 --> 00:03:34,430
And as you can see this is the keyboard final.

64
00:03:34,560 --> 00:03:41,070
So this is a constant and the type of this constant is integer and the name of this constant is.

65
00:03:41,190 --> 00:03:41,690
OK.

66
00:03:41,970 --> 00:03:48,370
And then I assigned the value of this index a local variable to this or a constant here.

67
00:03:48,510 --> 00:03:49,830
OK.

68
00:03:49,830 --> 00:03:57,360
And here as you can see inside of this for loop as you can see I created an image view as you can see

69
00:03:57,360 --> 00:03:57,850
here.

70
00:03:58,200 --> 00:04:00,210
And then here I instantiated this image.

71
00:04:00,270 --> 00:04:08,370
And then I specified the context in say the practices and then in line 40 I referred to this image here

72
00:04:09,390 --> 00:04:11,190
data set image resource.

73
00:04:11,190 --> 00:04:16,230
So here I want to actually output this image to this image view OK animal.

74
00:04:16,470 --> 00:04:18,800
That animal images some index.

75
00:04:18,900 --> 00:04:26,160
OK so it's going to actually site assign specific images that is inside of this specific index of these

76
00:04:27,000 --> 00:04:30,720
and as you can see here are two these are image view.

77
00:04:30,720 --> 00:04:31,330
OK.

78
00:04:31,800 --> 00:04:33,120
And here we call this.

79
00:04:33,120 --> 00:04:35,960
Let's set out perhaps for image view image view.

80
00:04:35,970 --> 00:04:39,930
So here we are calling this Smurfette that we actually created inside this class.

81
00:04:39,930 --> 00:04:43,920
So here we want to set the wheat and the height of this image view.

82
00:04:44,110 --> 00:04:44,590
OK.

83
00:04:44,640 --> 00:04:45,750
By calling this method.

84
00:04:45,990 --> 00:04:52,680
So because this image is going to be inside the linearly out it is OK that as you can see here we actually

85
00:04:52,680 --> 00:04:55,450
put this linearly out here today or tomorrow.

86
00:04:55,470 --> 00:04:55,890
OK.

87
00:04:55,920 --> 00:05:00,690
As you can see here in inside these are content on the alignment of the example here I need to click

88
00:05:00,700 --> 00:05:06,040
on a clear cashier as you can see here inside this componentry.

89
00:05:06,270 --> 00:05:08,720
This holds onto the scroll view.

90
00:05:08,770 --> 00:05:13,120
It actually has a child called linearly out horizontally.

91
00:05:13,220 --> 00:05:16,580
So our images are going to be inside these linearly or horizontal.

92
00:05:16,580 --> 00:05:17,090
OK.

93
00:05:17,120 --> 00:05:20,480
So the parent of those images is linearly out.

94
00:05:20,660 --> 00:05:24,530
So that's why we actually put this really anyone else here.

95
00:05:24,590 --> 00:05:28,530
Tattletales perhaps to specify the feet and the height of our image view.

96
00:05:28,660 --> 00:05:29,510
Okay.

97
00:05:30,110 --> 00:05:37,640
And here are I actually specify a padding some padding values for this image view 100 for the left 100

98
00:05:37,640 --> 00:05:41,810
for the top 100 for the right and 100 for the bottom.

99
00:05:42,080 --> 00:05:44,280
And here are I actually made this image.

100
00:05:44,300 --> 00:05:47,180
You are a listener to the clicks of the user.

101
00:05:47,180 --> 00:05:47,630
OK.

102
00:05:47,720 --> 00:05:51,390
So image you are certainly close and her new view that unclick listener.

103
00:05:51,440 --> 00:05:57,810
So here I actually created an anonymous in a class as you can see here that implements this article

104
00:05:57,900 --> 00:05:58,910
class and an interface.

105
00:05:58,910 --> 00:06:00,790
And it is actually implementing this method.

106
00:06:00,810 --> 00:06:02,740
Ok this abstract method.

107
00:06:03,350 --> 00:06:10,620
And here in say this uncle my faith I specify that every time the user clicks on this image view I enter

108
00:06:10,670 --> 00:06:12,660
animal data set image resource.

109
00:06:12,770 --> 00:06:17,770
So this animal is actually to go inside this content underline minute example.

110
00:06:17,840 --> 00:06:19,600
This is our I am the animal.

111
00:06:19,670 --> 00:06:20,320
OK.

112
00:06:20,720 --> 00:06:25,700
So I and the animal that said Image resource as you can see here.

113
00:06:25,900 --> 00:06:30,260
OK animal that animal images that are Suppe.

114
00:06:30,470 --> 00:06:35,020
So that's why we actually created this constant insight this fall.

115
00:06:35,060 --> 00:06:35,610
OK.

116
00:06:35,720 --> 00:06:42,680
So if they actually referred to this index as you can see here we cannot actually do that here because

117
00:06:43,060 --> 00:06:49,010
we are inside an inner class an anonymous inner class and we cannot actually refers to a variable that

118
00:06:49,010 --> 00:06:51,630
is not final inside of an inner class.

119
00:06:51,680 --> 00:06:57,690
And if I actually declare these are a local variable final Let's see what happens.

120
00:06:57,770 --> 00:07:04,710
Now here it is showing us an error and it says cannot assign a value to final value of an index.

121
00:07:04,730 --> 00:07:09,090
OK so if we cannot actually declare this index a valuable fine note.

122
00:07:09,170 --> 00:07:09,640
OK.

123
00:07:09,830 --> 00:07:15,360
So we actually created a constant inside this for a loop and the name of this constant is.

124
00:07:15,560 --> 00:07:18,190
And then I assigned this index to this.

125
00:07:18,290 --> 00:07:19,200
OK.

126
00:07:19,610 --> 00:07:22,310
So here I referred to this here.

127
00:07:22,380 --> 00:07:29,700
It's a constant so that we can actually get a specific image inside of these animal images array.

128
00:07:29,980 --> 00:07:30,410
OK.

129
00:07:30,470 --> 00:07:36,230
So then they use a click and a specific image that specific image is going to be assigned to this IMJ

130
00:07:36,290 --> 00:07:37,440
animal image view.

131
00:07:37,520 --> 00:07:38,240
OK.

132
00:07:38,960 --> 00:07:46,640
And here we call this let's say out let's sit out perhaps for you again we call this our method here.

133
00:07:46,640 --> 00:07:48,780
As you can see I am the animal.

134
00:07:49,070 --> 00:07:49,580
OK.

135
00:07:49,790 --> 00:07:55,490
It's going to actually sit out of set the image of your beach and the image of your height.

136
00:07:55,550 --> 00:07:57,200
And here we created toast.

137
00:07:57,200 --> 00:07:59,940
OK a toast that takes a make takes.

138
00:07:59,960 --> 00:08:06,830
And here for the first argument finish to specify the context main activity that this he here for the

139
00:08:06,830 --> 00:08:07,570
second argument.

140
00:08:07,600 --> 00:08:11,770
This is this is actually a text that you want to actually to show to the user.

141
00:08:11,840 --> 00:08:16,020
This is and this is the name of our enemy animal and animal that animal names.

142
00:08:16,040 --> 00:08:16,700
OK.

143
00:08:16,700 --> 00:08:22,240
So this is an array that you actually created inside this animal our class animal names.

144
00:08:22,340 --> 00:08:22,760
OK.

145
00:08:22,850 --> 00:08:23,640
And he called.

146
00:08:23,740 --> 00:08:26,250
He actually declares this array as each.

147
00:08:26,520 --> 00:08:27,640
OK.

148
00:08:27,710 --> 00:08:28,430
All right.

149
00:08:28,640 --> 00:08:31,640
OK I'll toast that Len for short.

150
00:08:31,650 --> 00:08:38,780
So this is the duration of the text and we're calling this a show him effort on this MF at here and

151
00:08:38,840 --> 00:08:40,900
now after this uncle listener.

152
00:08:40,910 --> 00:08:45,960
Here we are actually adding this image view to this linearly out horizontal.

153
00:08:46,220 --> 00:08:46,870
OK.

154
00:08:46,970 --> 00:08:51,680
So inside this content underline minute example you have this linearly and what is on.

155
00:08:52,100 --> 00:08:58,550
So if we are adding those images that is a linearly or horizontal until the actually the value of the

156
00:08:58,610 --> 00:09:04,600
index value is less than the value of the length of these images array.

157
00:09:04,730 --> 00:09:11,090
OK so now let's actually run our project and see what happens.

158
00:09:11,090 --> 00:09:15,820
So as you can see here now our application is running on this emulator.

159
00:09:15,950 --> 00:09:19,320
And he had as he had said these are our animal images inside the gallery.

160
00:09:19,370 --> 00:09:21,610
Here you can see these images in say the gallery.

161
00:09:21,830 --> 00:09:27,900
And here you have these are our animal images inside the horizontal scroll view.

162
00:09:28,070 --> 00:09:32,990
So here as you can see if you scroll to the left now I can see these images here.

163
00:09:33,140 --> 00:09:40,580
OK so for example if I actually click on this chat here now if I scroll down I can see the image of

164
00:09:40,580 --> 00:09:41,610
this cat here.

165
00:09:41,840 --> 00:09:42,360
OK.

166
00:09:42,500 --> 00:09:46,010
And if you actually scroll to the left they can actually click on this.

167
00:09:46,020 --> 00:09:47,040
Now here.

168
00:09:47,270 --> 00:09:54,580
Now we can see the image of this tau and the TOSed that actually shows us that the text of the message.

169
00:09:54,860 --> 00:10:00,480
And here if I click on this Dolfin you can see it says this is Dalfin and this is the image so let me

170
00:10:00,480 --> 00:10:01,950
explain to you what's going on here.

