1
00:00:00,480 --> 00:00:07,310
So here as you can see we have actually a variable of type assets manager and the name of this society.

2
00:00:07,400 --> 00:00:08,590
It is assets.

3
00:00:08,760 --> 00:00:15,450
And then I was an assignment operator here and then I called the Smurfit good activity that get assets

4
00:00:15,870 --> 00:00:21,900
so the Smurfette assets is going to actually allow us to access the assets folder that we have here

5
00:00:21,900 --> 00:00:23,000
inside our project.

6
00:00:23,010 --> 00:00:28,170
As you can see this is actually the structure of our project and here we can actually see the assets

7
00:00:28,170 --> 00:00:28,890
fall there.

8
00:00:29,280 --> 00:00:34,060
And that's the purpose of this line of call here if we can actually to access these assets for them.

9
00:00:34,260 --> 00:00:39,570
And you can actually just by referring to the name of these assets here I can access this assets folder

10
00:00:39,630 --> 00:00:43,890
and then I can actually access the values that are inside of these assets folder.

11
00:00:44,250 --> 00:00:47,670
So now let's actually go back into our code here.

12
00:00:48,150 --> 00:00:52,810
As you can see we have actually a tribe like here and we have actually a catch block.

13
00:00:52,980 --> 00:00:59,580
So let's first let's actually look at our pro-black here so try and now as you can see here inside Apprentice's

14
00:00:59,610 --> 00:01:02,810
of this tripe like here I put a line of code here.

15
00:01:02,940 --> 00:01:08,700
So input stream and as you can see the name of this variable is stream.

16
00:01:08,820 --> 00:01:14,420
So the data type of this variable is input stream and then I put an assignment operator here.

17
00:01:15,450 --> 00:01:20,790
And then you referred to the name of these assets here in order to access the assets for inside our

18
00:01:20,790 --> 00:01:21,830
project.

19
00:01:21,930 --> 00:01:30,450
And now I want to open the assets folder and I want to actually access the image that is inside of that

20
00:01:30,510 --> 00:01:31,590
assets folder.

21
00:01:31,590 --> 00:01:37,980
So as you can see here assets that operate assets that open and then first I need to actually specify

22
00:01:37,980 --> 00:01:42,470
that up which folder you want to actually access the images.

23
00:01:42,630 --> 00:01:47,460
So for example let me show you the structure of the project as you can see if we have two folders.

24
00:01:47,460 --> 00:01:50,870
The first one is that tape Underland animals folder.

25
00:01:51,000 --> 00:01:55,180
And the second folder is on that animal for animals for that.

26
00:01:55,500 --> 00:02:00,940
And this false folder is actually for fun but we want to actually access the images right.

27
00:02:00,960 --> 00:02:08,510
So now first I need to specify actually the animal type tame animal or wild animal right.

28
00:02:08,790 --> 00:02:12,580
And then I actually put this plus operator here.

29
00:02:12,720 --> 00:02:18,480
And then inside the double quotes as you can see I put a slash and then again another plus operator

30
00:02:18,480 --> 00:02:23,370
here and then here I need to specify the name of the image right.

31
00:02:23,430 --> 00:02:26,220
So next animal image name as you can see here.

32
00:02:26,220 --> 00:02:33,150
This is going to be the name of the image and then for example I can I see the image plus dot P and

33
00:02:33,150 --> 00:02:34,840
g as you can see here.

34
00:02:34,950 --> 00:02:40,890
So now let me show you the emulator as you can see this is our emulator and here this is actually the

35
00:02:40,890 --> 00:02:44,900
image of the animal that we want to show to the user.

36
00:02:44,940 --> 00:02:51,300
So here because I want to actually load this image here I'd need to actually access First of all the

37
00:02:51,300 --> 00:02:53,170
assets folder as you can see here.

38
00:02:53,460 --> 00:02:59,790
And then I need to open the assets folder and then first of all I need to specify specify the type of

39
00:02:59,790 --> 00:03:03,880
this animal whether this is actually a tame animal or a wild animal.

40
00:03:03,900 --> 00:03:11,650
So if we put this animal type here plus slash plus And then I need to specify the name of the animal.

41
00:03:11,670 --> 00:03:16,740
So our next animal image name as you can see here I referred to the name of this Raddy label that actually

42
00:03:16,740 --> 00:03:18,840
holds the name of this animal.

43
00:03:19,110 --> 00:03:22,130
Plus dot P and G.

44
00:03:22,440 --> 00:03:28,920
So it's very important that you actually put this plus the piano here because we actually get this next

45
00:03:28,920 --> 00:03:33,380
animal in its name from these animals names cuius least here from this list.

46
00:03:33,600 --> 00:03:40,330
And the images that are inside of these animals names is this but I actually doubt that it does indeed.

47
00:03:40,380 --> 00:03:40,860
OK.

48
00:03:40,980 --> 00:03:46,220
So it's very important that we want to load the image to the image view here.

49
00:03:46,230 --> 00:03:52,320
It's very important that you specify the name of the animal and then you need to actually add to this

50
00:03:52,330 --> 00:03:57,280
that into here so that we can actually load this image here inside our image view.

51
00:03:57,540 --> 00:04:03,460
So now as you can see if you have this stream here and then let's actually go inside these tribal like

52
00:04:03,480 --> 00:04:04,060
here.

53
00:04:04,260 --> 00:04:08,590
And as you can see we're actually actually created a variable of type tribal.

54
00:04:08,610 --> 00:04:13,040
So anality actually double click on the map here in order to make this area wider.

55
00:04:13,110 --> 00:04:18,940
So triable and the name of my valuable is animal image assignment operator.

56
00:04:18,960 --> 00:04:24,340
And then you referred to the name of this tribal class that create frumps upstream.

57
00:04:24,420 --> 00:04:27,060
So I want to actually create an image from a stream.

58
00:04:27,090 --> 00:04:32,540
So here we are specified in say they're actually inside their pantheists of this tree block here as

59
00:04:32,540 --> 00:04:34,830
you can see I specified this dream right.

60
00:04:34,830 --> 00:04:40,680
I created a variable of type input stream and then I actually opened the assets for them and then I

61
00:04:40,680 --> 00:04:45,510
actually accessed this specific image that I want to actually load here.

62
00:04:45,960 --> 00:04:51,400
So here I actually created valuable after each of triable tribal animal image assignment operator.

63
00:04:51,420 --> 00:04:57,480
So Dr. Bell thought create frumps stream and then decide if it accepts two arguments the first one is

64
00:04:57,480 --> 00:05:01,410
this thing that you specified here inside the prentices of this block.

65
00:05:01,440 --> 00:05:05,690
And the second argument is the name of the image that you want to load here.

66
00:05:05,850 --> 00:05:08,650
So the next animal image name as you can see here.

67
00:05:08,670 --> 00:05:09,930
Right.

68
00:05:09,930 --> 00:05:14,970
So we actually created this value but here in line number three hundred and twenty nine next any image

69
00:05:14,970 --> 00:05:15,560
name.

70
00:05:15,900 --> 00:05:22,310
And now in order to make this concept more clear let me actually call this sniff it again.

71
00:05:22,350 --> 00:05:29,310
So triable dots create create from Stream.

72
00:05:29,490 --> 00:05:31,400
And now let's actually look at the arguments.

73
00:05:31,500 --> 00:05:34,890
The first argument is this is an input stream as you can see here.

74
00:05:34,890 --> 00:05:43,020
So we created an input stream object here and now let me show you the actually the second argument which

75
00:05:43,020 --> 00:05:46,630
is actually of type screen and the name is source name.

76
00:05:46,680 --> 00:05:52,960
So the source name is next animal image name the name of the animal that you want to actually load here.

77
00:05:53,780 --> 00:05:56,540
So hopefully that makes sense.

78
00:05:56,660 --> 00:06:03,830
And now as you can see in line number three hundred forty five I actually first took this image view

79
00:06:03,910 --> 00:06:05,030
I and you and him.

80
00:06:05,360 --> 00:06:10,400
So this is actually the image for you that set him a tribal animal image.

81
00:06:10,910 --> 00:06:11,150
Right.

82
00:06:11,150 --> 00:06:16,160
So in this way we can actually look at the image here and then as you can see here all you want to actually

83
00:06:16,390 --> 00:06:22,520
are for example of when you want to show the next question I've been able to show the next guess the

84
00:06:22,520 --> 00:06:24,980
next animal image to the user.

85
00:06:25,020 --> 00:06:28,280
You want to animated so animate animal Cooley's false.

86
00:06:28,400 --> 00:06:32,320
So for the animate out boolean value but a the value false.

87
00:06:32,390 --> 00:06:37,840
So it's going to actually create an animation effect that starts from here and ends here.

88
00:06:37,850 --> 00:06:39,910
So I actually showed you this concept.

89
00:06:39,920 --> 00:06:43,640
I actually show you this I showed you this animation.

90
00:06:43,640 --> 00:06:47,900
In fact in the previous tutorial in the previous tutorial.

91
00:06:48,110 --> 00:06:54,020
So now if we actually for example choose the rabbit here now it can actually perform and animate out

92
00:06:54,080 --> 00:06:59,870
and then as you can see it's going to perform another animation in fact that starts from here and ends

93
00:06:59,870 --> 00:07:00,470
here.

94
00:07:00,710 --> 00:07:02,640
In order to show the next image.

95
00:07:03,200 --> 00:07:07,120
So animated out so animate animal is false.

96
00:07:07,130 --> 00:07:13,730
So the for this argument I passed the value falls and then here we have the scratch block here.

97
00:07:13,730 --> 00:07:16,470
So this test here is going to actually.

98
00:07:16,670 --> 00:07:22,660
For example if we have problems in order to actually access the images inside our assets folder does

99
00:07:22,670 --> 00:07:26,330
catch up blocking is going to catch that exception.

100
00:07:26,330 --> 00:07:30,160
And then it's going to actually lug a message like that.

101
00:07:30,200 --> 00:07:35,350
Eat animal cookies and the message is there is an error Catinat Plus next.

102
00:07:35,360 --> 00:07:37,930
And in one image name so it says there is an example.

103
00:07:37,940 --> 00:07:45,190
If the device cannot actually access the image it's going to actually just put this value in the console.

104
00:07:45,200 --> 00:07:51,080
There is an irritating and then it's going to just put the next animal image name to the console and

105
00:07:51,080 --> 00:07:56,330
then it's going to just put a description about this exception in the console.

106
00:07:56,330 --> 00:08:02,480
So here let's actually look at the other lines of code here in line number three hundred and fifty free

107
00:08:02,480 --> 00:08:03,760
as you can see here.

108
00:08:04,190 --> 00:08:06,490
So now let's look at this line of code here.

109
00:08:06,590 --> 00:08:10,620
As you can see it referred to the name of this class collection's.

110
00:08:10,640 --> 00:08:14,160
So here this is actually a predefined class in Java.

111
00:08:14,480 --> 00:08:20,600
And we can actually access this class and we can actually use some of the methods that we have inside

112
00:08:20,630 --> 00:08:21,300
this class.

113
00:08:21,320 --> 00:08:24,890
If you want to actually know more about about this class.

114
00:08:24,980 --> 00:08:29,670
But just see this class inside this inside the Adalbert documentation.

115
00:08:29,830 --> 00:08:33,850
So collections has actually a method called shuffle.

116
00:08:34,130 --> 00:08:40,550
And we can actually use this method in order to shovel to shuffle the actually the values that we have

117
00:08:40,550 --> 00:08:41,960
inside the list.

118
00:08:41,990 --> 00:08:46,240
So here as you can see we have actually all animals names list.

119
00:08:46,430 --> 00:08:52,040
And because I don't want to make that queasy I don't want to make the Cooley's questions are predictable

120
00:08:52,490 --> 00:08:55,550
and I don't want to be the questions to be in order.

121
00:08:55,550 --> 00:09:01,480
I want the questions to be on order right so that the user can actually see different images or see

122
00:09:01,490 --> 00:09:06,590
different animal images later when the squeeze is actually to reset or bent.

123
00:09:06,620 --> 00:09:09,450
For example the use that is actually starting the quiz in.

124
00:09:09,450 --> 00:09:13,010
Another time I want the questions to be on order.

125
00:09:13,080 --> 00:09:15,920
You want to advance the animal image has to be on order.

126
00:09:16,070 --> 00:09:22,550
So I want to actually shuffle the images that are inside of this list so collections that shuffle all

127
00:09:22,640 --> 00:09:27,860
animals names list and that it's going to try to shuffle all the animals names these and it's going

128
00:09:27,860 --> 00:09:33,420
to actually just make it up on an ordered list of animals.

129
00:09:33,620 --> 00:09:37,740
And then in this way our quiz is actually more unpredictable.

130
00:09:37,820 --> 00:09:42,620
So now that these are animals names this is actually shuffled.

131
00:09:42,980 --> 00:09:45,820
Let's look at let's actually look at the other lines of code here.

