1
00:00:00,280 --> 00:00:00,820
So.

2
00:00:00,840 --> 00:00:04,800
Now let's actually look at these Meffert here and create a view right.

3
00:00:04,800 --> 00:00:10,770
So here we are actually writing this method uncreate view and this live at X. It's free arguments.

4
00:00:10,770 --> 00:00:15,330
The first one is inflator which is of type layout inflator.

5
00:00:15,390 --> 00:00:19,410
The second argument is of type view group which is container.

6
00:00:19,680 --> 00:00:25,490
And as you can see the first argument is actually saved instance state because of the bundle.

7
00:00:25,710 --> 00:00:30,770
And here as you can see we are actually returning a value of type view.

8
00:00:30,810 --> 00:00:38,110
So as you can see here the returned type the return value actually of these Smurfit is actually of type

9
00:00:38,160 --> 00:00:38,840
view right.

10
00:00:38,850 --> 00:00:42,260
So we must return a value of type view from this method.

11
00:00:42,300 --> 00:00:44,960
So here it says Return inflator.

12
00:00:45,060 --> 00:00:49,520
So here it refers to this inflator argument that inflate.

13
00:00:49,650 --> 00:00:53,740
It calls this inflate Meffert on this inflator here on this replated object.

14
00:00:53,940 --> 00:00:59,070
And for the first argument if you're actually passing this a fragment underline main that exemption

15
00:00:59,370 --> 00:01:04,610
for the second argument we're passing the container and for the first argument we're passing the value

16
00:01:04,610 --> 00:01:05,350
falls.

17
00:01:05,370 --> 00:01:11,940
So I already talked about this effect and you already know about these arguments and you all also know

18
00:01:11,940 --> 00:01:14,410
how what are these arguments are doing here.

19
00:01:14,430 --> 00:01:15,390
Right.

20
00:01:15,600 --> 00:01:25,850
So now let's actually create a value of type view and let's assign this value as you can see here.

21
00:01:25,850 --> 00:01:29,570
This inflates if it actually returns a value of type view.

22
00:01:29,640 --> 00:01:36,750
So we can actually assign that return value to a object of type view.

23
00:01:36,750 --> 00:01:37,380
Right.

24
00:01:37,380 --> 00:01:41,930
So if I actually hold the comment here on my keyboard and if you are using a Windows machine you need

25
00:01:41,930 --> 00:01:43,880
to hold the control on your keyboard.

26
00:01:44,100 --> 00:01:51,300
And if I click on this inflate here as you can see now you can see that this may if it inflate actually

27
00:01:51,480 --> 00:01:53,280
returns a value of type view.

28
00:01:53,280 --> 00:02:01,150
So you can see that the returned value the return type actually of this method is View right.

29
00:02:01,320 --> 00:02:06,690
So that's why you can see that we can assign the return value to this view object.

30
00:02:06,690 --> 00:02:09,290
So we created you are valuable here.

31
00:02:09,570 --> 00:02:12,220
So now I'm going to pasting some more lines of code here.

32
00:02:12,210 --> 00:02:18,000
Inside is uncreate me angry at you and then I'm going to explain to you what's going on here.

33
00:02:18,120 --> 00:02:24,710
So as you can see here these are the lines of code that I pasted inside this uncreate view Meffert.

34
00:02:24,810 --> 00:02:31,290
So as you can see in line number 54 I am actually initializing these all animal names at least assignment

35
00:02:31,290 --> 00:02:33,340
operator new at least here right.

36
00:02:33,390 --> 00:02:36,770
So here we are actually assigning an empty Aurelia's to this.

37
00:02:36,780 --> 00:02:39,200
All animals name names list.

38
00:02:39,210 --> 00:02:44,680
So as you can see here in line number 27 we actually declared this list here.

39
00:02:44,740 --> 00:02:49,900
All animals names list and we assigned an empty out a list to this valuable.

40
00:02:49,950 --> 00:02:51,420
All animals names list.

41
00:02:51,540 --> 00:02:58,050
So in number 55 as you can see here we have animals names quis list assignment operator new alias.

42
00:02:58,080 --> 00:03:05,670
So again we are assigning an empty list to these animals names quiz list in line number 56.

43
00:03:05,710 --> 00:03:08,230
We're actually initialising the secure random number.

44
00:03:08,250 --> 00:03:14,700
So take your random number assignment operator new set your random number so we use this valuable here

45
00:03:14,730 --> 00:03:19,640
in order to actually choose our random animal inside our quiz.

46
00:03:19,650 --> 00:03:22,410
So now let me show you the emulator.

47
00:03:22,410 --> 00:03:26,580
So as you can see here our application is running on this emulator.

48
00:03:26,700 --> 00:03:33,050
And now for example we want to actually guess what is where it's going to be the name of this animal

49
00:03:33,060 --> 00:03:34,130
for example this is Cat.

50
00:03:34,170 --> 00:03:34,920
Right.

51
00:03:35,220 --> 00:03:42,450
And we use this secure random number in order to actually get our random animal from the list and put

52
00:03:42,450 --> 00:03:44,110
it here inside our case.

53
00:03:44,160 --> 00:03:48,710
Right so here we have for example an eagle and we can actually guess the name of the eagle.

54
00:03:48,720 --> 00:03:50,810
And now it's his right.

55
00:03:50,910 --> 00:03:54,540
And now it's going to show us the next image right.

56
00:03:54,840 --> 00:03:59,540
So here as you can see we have actually initialising this random number.

57
00:03:59,880 --> 00:04:04,880
And here we are initialising these handler so handler assignment operator new handler.

58
00:04:04,950 --> 00:04:05,660
Right.

59
00:04:05,760 --> 00:04:11,190
So now we get a pasting up sound like some lines of code here and there then I'm going to explain to

60
00:04:11,190 --> 00:04:13,280
you what's going on here.

61
00:04:13,530 --> 00:04:19,350
So as you can see here these are the lines of code that I pasted here and now I'm going to explain to

62
00:04:19,350 --> 00:04:20,450
you what's going on here.

63
00:04:20,460 --> 00:04:21,310
Exactly.

64
00:04:21,570 --> 00:04:23,300
So a line number 61 here.

65
00:04:23,310 --> 00:04:26,610
I actually referred to this line and said animation here.

66
00:04:26,610 --> 00:04:34,170
So I declared this animation here is in line actually in line number 47 as you can see here which is

67
00:04:34,170 --> 00:04:37,710
after an image animation right Ron and said animation.

68
00:04:37,710 --> 00:04:41,510
So here inside this uncreate and create Mefford uncreate view.

69
00:04:41,580 --> 00:04:47,600
Actually I want to actually add here inside is uncreate view method.

70
00:04:47,640 --> 00:04:52,940
You want to initialize this right answer animation so I referred to the name of this animation here.

71
00:04:52,950 --> 00:04:58,910
Wrong answer animation assignment operator animation Attila's dot load animation.

72
00:04:59,040 --> 00:05:03,300
So we actually created and exemplified inside our project.

73
00:05:03,300 --> 00:05:06,940
So now let me show you the structure of the project.

74
00:05:07,260 --> 00:05:13,650
As you can see here we actually created this folder here and inside this folder we have this animation

75
00:05:13,900 --> 00:05:16,360
Ron underlined and said underline animation.

76
00:05:16,470 --> 00:05:18,510
So if you want to look at this animation.

77
00:05:18,690 --> 00:05:23,850
So animation is that animation first you're going to pass the context.

78
00:05:23,850 --> 00:05:26,580
So the context is going to be get activity.

79
00:05:26,580 --> 00:05:32,340
So it's going to automatically get the activity as the context and for the second argument to actually

80
00:05:33,720 --> 00:05:39,390
assign a reference to this specific anime animation file that we have inside our project.

81
00:05:39,390 --> 00:05:43,720
So our thoughts on that that and answer animation as you can see here.

82
00:05:43,770 --> 00:05:44,320
Right.

83
00:05:44,370 --> 00:05:45,130
So here we are.

84
00:05:45,130 --> 00:05:51,360
Initialising this valuable run and said animation and here we are actually calling on effect on this

85
00:05:51,360 --> 00:05:51,870
animation.

86
00:05:51,870 --> 00:05:52,470
Wrong answer.

87
00:05:52,470 --> 00:05:55,290
And he mentioned that said repeat count 1.

88
00:05:55,320 --> 00:06:00,110
So it's going to actually repeat this animation only one a one time only once.

89
00:06:00,300 --> 00:06:04,320
So for example let me show you the emulator here for example.

90
00:06:04,320 --> 00:06:11,390
Now let me show you another image here and this is for this is actually a flappy bird right.

91
00:06:11,390 --> 00:06:17,230
So now I choose Fox and I was going to only execute this animation on the one time.

92
00:06:17,490 --> 00:06:23,670
So that's the job of this set up with Chown here and now I'm going to actually into some more lines

93
00:06:23,670 --> 00:06:27,740
of code here and then I'm going to explain to you what's going on here.

94
00:06:27,870 --> 00:06:31,000
So now let me show you the structure of the project.

95
00:06:31,020 --> 00:06:35,840
So just click on here our view tool windows and then our project.

96
00:06:36,090 --> 00:06:42,060
And now just go inside this layout folder inside this rest folder and then double click on this flight

97
00:06:42,110 --> 00:06:44,200
meant underlayment at examen here.

98
00:06:44,220 --> 00:06:50,800
As you can see we have this linear left right at the top so now I want to ask you to change the ID of

99
00:06:50,800 --> 00:06:52,060
this linearly out.

100
00:06:52,270 --> 00:06:59,420
So as you can see here this is the id attribute and the id attribute here is a content underline made.

101
00:06:59,530 --> 00:07:08,140
So I want to change this value to another value so I can just typing animal quis animal cuius linear

102
00:07:09,120 --> 00:07:09,550
layout

103
00:07:12,430 --> 00:07:12,860
Okay.

104
00:07:12,930 --> 00:07:18,110
So this is going to be the ID of the top linear layout here inside are exemplified.

105
00:07:18,270 --> 00:07:23,930
So if I click on the preview here at the right hand side and now if I click on this linearly out here

106
00:07:23,970 --> 00:07:29,390
as you can see now here it is referring to the top linear layout.

107
00:07:29,480 --> 00:07:37,010
Right so now let's actually go back inside our main activity AFFREIGHTMENT the java file here and DoubleClick

108
00:07:37,120 --> 00:07:37,710
stop here.

109
00:07:37,710 --> 00:07:40,080
In order to make this area wider.

110
00:07:40,380 --> 00:07:42,620
Now I'm going to paste in some lines of code here.

111
00:07:42,930 --> 00:07:47,870
So now as you can see here these are the lines of code that I pasted here.

112
00:07:47,940 --> 00:07:51,420
And now I'm going to explain to you what's going on here exactly.

113
00:07:51,420 --> 00:07:57,330
So in line number 66 as you can see here are you referred to this animal is linear.

114
00:07:57,360 --> 00:07:59,030
So now let me scroll to the top here.

115
00:07:59,040 --> 00:08:04,100
As you can see we have these animal linearly out here.

116
00:08:04,290 --> 00:08:06,790
So this is our animalcules linear layout.

117
00:08:06,810 --> 00:08:11,520
So this is of type linearly out private linear length linearly out.

118
00:08:11,520 --> 00:08:19,050
And I told you that we created this variable here in order to actually hold the value of the color of

119
00:08:19,050 --> 00:08:20,300
the willynilly out.

120
00:08:20,300 --> 00:08:25,590
So for example when the user wants to change the background color of the linear length of the keys we

121
00:08:25,590 --> 00:08:29,570
can actually hold that value and we can set that value on are linearly out here.

122
00:08:29,580 --> 00:08:33,940
So this is really important that we create are valuable for our linear layout.

123
00:08:34,050 --> 00:08:36,740
And as you can see the name is animalcules linearly.

124
00:08:36,810 --> 00:08:38,510
So now let me scroll down here.

125
00:08:40,320 --> 00:08:42,630
So here I want to initialize that variable.

126
00:08:42,630 --> 00:08:48,720
So animalcules linearly out assignment operator and here I am testing this value to our linear layout

127
00:08:49,230 --> 00:08:56,840
and view that find view by I-T are that idea that animalcules linear layout as you can see here.

128
00:08:56,880 --> 00:09:02,750
So here I initialized this animalcules linear layout and then here we have these t XTi.

129
00:09:02,750 --> 00:09:04,080
Question number.

130
00:09:04,290 --> 00:09:09,450
So again we actually declared that this takes the question number which is of type takes few here in

131
00:09:09,450 --> 00:09:11,060
line number 40.

132
00:09:11,160 --> 00:09:12,230
As you can see here.

133
00:09:12,270 --> 00:09:19,020
So this rally is going to hold the value of the text of the question number that you want to show to

134
00:09:19,020 --> 00:09:19,670
the user.

135
00:09:19,800 --> 00:09:22,770
So now let's scroll down here.

136
00:09:22,800 --> 00:09:26,240
I want to actually initialize this variable th's the question number.

137
00:09:26,250 --> 00:09:27,330
Assignment operator.

138
00:09:27,390 --> 00:09:31,690
So here I am casting this value to a text view object view.

139
00:09:31,700 --> 00:09:39,330
That's fine by as you can see here because here we are actually inside of this fragment we must refer

140
00:09:39,330 --> 00:09:40,480
to this view.

141
00:09:40,510 --> 00:09:44,710
OK this is very important as you can see we created this view here in line number 52.

142
00:09:44,910 --> 00:09:48,510
And here we want to inflate this fragment on the container.

143
00:09:48,510 --> 00:09:53,900
So the container is actually made activity and we have a fragment here.

144
00:09:53,910 --> 00:09:54,290
Right.

145
00:09:54,360 --> 00:10:00,570
So if you want to inflate the fragment on the container which is of type Bugel up so it is very important

146
00:10:00,570 --> 00:10:07,260
that we get a view which is that specific fragment as you can see here let me show you that structure

147
00:10:07,260 --> 00:10:08,360
of the project.

148
00:10:08,440 --> 00:10:14,800
And now let me kind of view tool windows and then project here as you can see inside this layout folder.

149
00:10:14,910 --> 00:10:21,700
We have activity on the line main We have content on the line main and we have fragment underline main.

150
00:10:21,870 --> 00:10:25,720
So here as you can see it is activity under load that example here.

151
00:10:25,770 --> 00:10:30,360
It is actually included in this content underlayment and its image here right.

152
00:10:30,400 --> 00:10:36,710
And here are content underly minute exam and he is actually holding this fragment.

153
00:10:36,720 --> 00:10:42,790
So this content underly minute example here is going to be the view group of these fragment underline

154
00:10:42,810 --> 00:10:43,660
minute example.

155
00:10:43,710 --> 00:10:51,330
So we need to actually get the reference to this fragment and then we can actually access it the components

156
00:10:51,390 --> 00:10:53,130
that we have inside this fragment.

157
00:10:53,220 --> 00:10:58,920
As you can see if you have bartend we have linear layouts and we have image views and so much other

158
00:10:59,040 --> 00:11:00,210
components.

159
00:11:00,210 --> 00:11:05,940
So if I actually go back inside this main activity fragment that of a file here that this is very important

160
00:11:06,120 --> 00:11:11,070
that when I want to initialize these actually variables I actually as you can see here I am referring

161
00:11:11,070 --> 00:11:13,440
to this view here.

162
00:11:13,830 --> 00:11:20,570
And then I try to call find viewable ID and then I referred to that specific component inside that Brightman's.

163
00:11:20,730 --> 00:11:22,060
This is very important.

164
00:11:22,230 --> 00:11:29,010
So hopefully you get the idea and now as you can see I am initialising this takes the question number

165
00:11:29,010 --> 00:11:35,010
of you that find the way Id are that ID that he the question number and we have I am the animal I am

166
00:11:35,050 --> 00:11:37,730
casting it to an image view for you.

167
00:11:38,010 --> 00:11:38,770
Thats fine.

168
00:11:38,830 --> 00:11:45,040
Id artist Id that I anti-animal and now I want to talk about these lines of code here.

169
00:11:45,180 --> 00:11:46,110
As you can see.

170
00:11:46,350 --> 00:11:49,590
So now just pay attention to these lines of code.

171
00:11:49,590 --> 00:11:50,550
This is very important.

