1
00:00:01,080 --> 00:00:07,360
And we have a WHILE loop here as you can see it says void or the value of this half height variable

2
00:00:07,590 --> 00:00:11,220
as you can see inside of this if statement.

3
00:00:11,410 --> 00:00:14,850
It actually created two other local variables.

4
00:00:14,850 --> 00:00:16,860
Final INT half white.

5
00:00:16,860 --> 00:00:18,890
So this is this is actually a constant.

6
00:00:19,080 --> 00:00:19,640
OK.

7
00:00:19,980 --> 00:00:25,890
And it actually divided the value of this height constant by 2 and then assign that value to these half

8
00:00:25,890 --> 00:00:33,650
height are constant and then it did the same job for this half year half with assignment operator.

9
00:00:33,840 --> 00:00:35,330
We divide it by two.

10
00:00:35,340 --> 00:00:35,990
OK.

11
00:00:36,240 --> 00:00:43,360
And here it says if half height divided by sample size as you can see here is greater than the equator.

12
00:00:43,590 --> 00:00:52,310
And we have an and logical operator here half Viets divided by in sample size is greater than required

13
00:00:52,310 --> 00:00:52,910
V.

14
00:00:53,400 --> 00:00:59,280
Then it's going to actually multiply the value of this in sample size by 2 and then it's going to assign

15
00:00:59,280 --> 00:01:02,040
that value again to this in sample size here.

16
00:01:02,040 --> 00:01:06,660
So this line of code is actually the same as this line of code that I am going to write here.

17
00:01:06,660 --> 00:01:11,860
In sample size assignment operator in sample size multiplied by two.

18
00:01:12,270 --> 00:01:12,940
OK.

19
00:01:13,140 --> 00:01:16,050
So let me ask you to comment on this line of code here.

20
00:01:16,550 --> 00:01:20,400
And as you can see here it's going to return in sample size for us.

21
00:01:20,430 --> 00:01:21,050
OK.

22
00:01:21,420 --> 00:01:24,860
So what this value would be the proper sample size for our image.

23
00:01:24,870 --> 00:01:25,270
Okay.

24
00:01:25,440 --> 00:01:28,160
And if this effort doesn't make any sense to you.

25
00:01:28,360 --> 00:01:28,580
OK.

26
00:01:28,590 --> 00:01:33,600
Don't forget you don't have to know whether these calculations but I know that this is going to actually

27
00:01:33,600 --> 00:01:36,920
give us the proper sample size that we can use on our image.

28
00:01:37,020 --> 00:01:43,290
OK so that application doesn't crash and we have another method in Android documentation as you can

29
00:01:43,290 --> 00:01:43,820
see here.

30
00:01:43,840 --> 00:01:44,680
We have this before.

31
00:01:44,700 --> 00:01:51,450
And it says to use this method first decode with in just decode bounds set to true past the options

32
00:01:51,450 --> 00:01:58,000
for loop and then decode again using the new in sample size value and in just D-CT band for us.

33
00:01:58,080 --> 00:02:00,600
OK so what is this.

34
00:02:00,630 --> 00:02:07,780
In just the code bounds we have it actually introduced us this introduced this variable to us here.

35
00:02:07,800 --> 00:02:14,220
As you can see sitting there in just a decode decode Pound's property to True.

36
00:02:14,880 --> 00:02:18,950
While decoding our memory allocation returning NULL.

37
00:02:18,990 --> 00:02:22,470
OK so it is not going to actually assign that image to the image view.

38
00:02:22,500 --> 00:02:27,790
If you actually assigned a value to do this are valuable for the bitmap object but setting out with

39
00:02:27,970 --> 00:02:34,860
and outside and out out my type so if this is the type of OUR image and here it says that we have this

40
00:02:34,860 --> 00:02:35,510
method here.

41
00:02:35,520 --> 00:02:36,110
OK.

42
00:02:36,150 --> 00:02:38,870
So let's actually copy this method here.

43
00:02:38,880 --> 00:02:39,640
OK.

44
00:02:40,050 --> 00:02:44,760
And let's actually go to our project and it's actually paste this method here and we have this method

45
00:02:44,760 --> 00:02:45,270
here.

46
00:02:45,450 --> 00:02:50,340
OK public static bitmap code sample to bitmap from the source.

47
00:02:50,380 --> 00:02:55,280
Ok so it is going to actually decode the images that are inside of our resources here.

48
00:02:55,290 --> 00:03:04,380
As you can see and here we have a reference to our resources as we have the rest ID of the ID of our

49
00:03:04,710 --> 00:03:05,470
resources.

50
00:03:05,580 --> 00:03:08,400
We have required reach and we have required it.

51
00:03:08,510 --> 00:03:09,200
OK.

52
00:03:09,660 --> 00:03:15,510
And here as you can see inside of this method first the code fit it in just de-code bands PETROU to

53
00:03:15,510 --> 00:03:16,720
check dimensions.

54
00:03:16,740 --> 00:03:23,340
So if you want to check the dimensions of your images set this value at this value but to true.

55
00:03:23,480 --> 00:03:24,270
OK.

56
00:03:24,310 --> 00:03:29,790
Final bitmap factory that options options new bitmapped fact that option.

57
00:03:29,790 --> 00:03:35,550
So you actually created an options object as you can see here but effectively that options and it said

58
00:03:35,830 --> 00:03:38,910
this in just the quarter bounce to true.

59
00:03:39,360 --> 00:03:43,400
It actually called this instance variable on this object.

60
00:03:43,470 --> 00:03:44,280
Okay.

61
00:03:44,280 --> 00:03:48,900
And then we have the speed map factor the class that decoder ring resource.

62
00:03:48,930 --> 00:03:54,630
So as you can see here it refers to this list of resources as you can see that we have as an argument.

63
00:03:54,630 --> 00:03:55,130
OK.

64
00:03:55,280 --> 00:04:01,470
Bitmapped fact is that the court that the court resource rests and we have this idea and we have all

65
00:04:01,680 --> 00:04:02,380
these options.

66
00:04:02,400 --> 00:04:03,110
OK.

67
00:04:03,520 --> 00:04:08,300
So on here as you can see it says calculate in sample size.

68
00:04:08,370 --> 00:04:10,830
So options that in sample size.

69
00:04:10,920 --> 00:04:15,930
Here it is actually calling the Smurfette that we actually pasted here.

70
00:04:16,020 --> 00:04:18,510
As you can see here calculate in sample size.

71
00:04:18,510 --> 00:04:22,050
So branchial it in sample size options.

72
00:04:22,050 --> 00:04:28,480
So as you can see the refers to the options object as you can see here required read and be quite tight.

73
00:04:28,620 --> 00:04:35,760
Okay so it is going to calculate the sample size according to our images for us and we have these options

74
00:04:35,790 --> 00:04:42,240
object that in just in just D-CT bounds two files so D-CT bitmap with sample size set.

75
00:04:42,240 --> 00:04:49,410
So as you can see here it says I said this these in sample size value to false so that we can actually

76
00:04:50,460 --> 00:04:52,930
output that image to the screen Okay.

77
00:04:53,130 --> 00:04:54,710
And here it is returned.

78
00:04:54,780 --> 00:05:00,490
We need to actually return an object of type bitmap as you can see here returned to our factory D-CT

79
00:05:00,560 --> 00:05:02,380
resource raise.

80
00:05:02,570 --> 00:05:08,180
So as you can see here it refers to these less resources less I.D. and options.

81
00:05:08,180 --> 00:05:08,580
OK.

82
00:05:08,630 --> 00:05:16,310
Now let's actually go back to our view method and here is actually typed in our EMG animal data sets.

83
00:05:16,340 --> 00:05:19,600
Image set image bitmap as you can see here.

84
00:05:20,000 --> 00:05:23,930
And here we need to actually put in an object of type bitmap OK.

85
00:05:24,110 --> 00:05:29,240
So here I'm just going to as you can see here it is Meffert as you can see it's going to return an object

86
00:05:29,270 --> 00:05:30,090
of type bitmap.

87
00:05:30,110 --> 00:05:32,130
So if we can i should call this Mfat here.

88
00:05:32,240 --> 00:05:34,610
As you can see in some of these practices.

89
00:05:34,610 --> 00:05:39,720
So the name of this method is the code sample sample bitmap from B source.

90
00:05:39,830 --> 00:05:46,240
So I can just type in de-code sampled bitmapped from the source and this is going to actually accept

91
00:05:46,300 --> 00:05:47,190
some arguments.

92
00:05:47,200 --> 00:05:47,860
OK.

93
00:05:47,890 --> 00:05:50,420
So the resources is context.

94
00:05:50,530 --> 00:05:50,910
OK.

95
00:05:50,920 --> 00:05:52,620
That's good resources.

96
00:05:52,930 --> 00:05:58,030
So it's going to actually get the resources of our project here we need to put into the idea of our

97
00:05:58,060 --> 00:06:02,610
images inside of our application inside our project.

98
00:06:02,620 --> 00:06:09,550
So the idea is animal images supposition as you can see here we have these animal images and we can

99
00:06:09,550 --> 00:06:18,180
actually refers to these ideas in these images by just typing animal images up position.

100
00:06:18,370 --> 00:06:21,750
So as you can see here you have these opposition as an argument.

101
00:06:21,820 --> 00:06:22,260
OK.

102
00:06:22,420 --> 00:06:27,930
So if we could just refer to the name of that position here and here let's actually create a newline

103
00:06:27,970 --> 00:06:30,140
character so that you can see these values better.

104
00:06:30,250 --> 00:06:37,690
And he had as he conceived of you need to actually specify the required and required height.

105
00:06:37,830 --> 00:06:38,230
OK.

106
00:06:38,320 --> 00:06:40,840
As you can see and so it is customized to this view.

107
00:06:40,840 --> 00:06:46,070
Here are the lay out feet and the length height of our image is 100.

108
00:06:46,090 --> 00:06:55,120
So here inside of these Prentice's I can assign the value of 50 comma 50 for the length width and height

109
00:06:56,090 --> 00:07:00,550
and now are actually on our project and see what happens.

110
00:07:00,550 --> 00:07:05,350
So as you can see here now our application is actually running on the simulator.

111
00:07:05,680 --> 00:07:11,190
And now you can see that we can actually scroll and we can see these images here.

112
00:07:11,290 --> 00:07:11,940
OK.

113
00:07:12,250 --> 00:07:15,230
And now our application actually doesn't crash.

114
00:07:15,340 --> 00:07:17,740
OK it's not actually taking too much memory.

115
00:07:18,160 --> 00:07:24,270
Ok but if your device has a very low memory it's going to actually take.

116
00:07:24,490 --> 00:07:30,340
And if the images are actually a high quality images they're going to take you taking too much memory

117
00:07:30,370 --> 00:07:33,040
and yet and then your application is going to actually crash.

118
00:07:33,040 --> 00:07:33,840
OK.

119
00:07:33,850 --> 00:07:39,310
So make sure that you always artist's your applications on an actual device.

120
00:07:39,310 --> 00:07:40,120
OK.

121
00:07:40,690 --> 00:07:46,270
And here if you want to actually your images if you want your images to take actually less memory you

122
00:07:46,270 --> 00:07:53,290
can actually assign for example a value for example first here for the layout for the required tweets

123
00:07:53,410 --> 00:07:55,290
and 40 for the required height.

124
00:07:55,630 --> 00:07:57,400
And this extra day on our project again.

125
00:07:57,430 --> 00:08:02,410
So as you can see our application is running on this emulator and you can see does that we have these

126
00:08:02,830 --> 00:08:03,780
images here.

127
00:08:03,940 --> 00:08:04,740
OK.

128
00:08:05,170 --> 00:08:12,700
And the quality of these images are a little bit low but you can see that our application is not actually

129
00:08:12,700 --> 00:08:13,900
taking too much memory.

130
00:08:13,900 --> 00:08:14,680
OK.

131
00:08:15,220 --> 00:08:17,630
So hopefully that makes sense.

132
00:08:17,680 --> 00:08:21,960
And now let's actually go back and say this customized this year that of a file.

133
00:08:22,120 --> 00:08:28,360
And if you have any questions about these concepts that I am actually teaching you in this tutorial

134
00:08:28,630 --> 00:08:33,670
please post the discussion in the course and then I'll do my best to answer all of your questions.

135
00:08:33,670 --> 00:08:36,610
But for now let's actually adding some more lines of code here.

136
00:08:36,760 --> 00:08:37,210
OK.

137
00:08:37,210 --> 00:08:41,720
And here where we actually created these string objects as you can see here.

138
00:08:41,920 --> 00:08:44,900
Let's actually create another string object here.

139
00:08:44,980 --> 00:08:45,450
OK.

140
00:08:45,650 --> 00:08:53,560
String and the name of this object is old RTX the animal name value.

141
00:08:54,050 --> 00:08:54,550
OK.

142
00:08:54,640 --> 00:09:03,420
Assignment operator and then I can just refer to the name of the animal name object that get text that

143
00:09:03,470 --> 00:09:04,540
to string.

144
00:09:05,110 --> 00:09:10,380
And here are let's actually add another vort here value on here.

145
00:09:10,520 --> 00:09:13,480
What do you call the name of these other objects.

146
00:09:13,480 --> 00:09:21,340
OK so we have an old x the animal name value we have an old text the animal power value and we have

147
00:09:21,580 --> 00:09:23,790
an old text the animals speak about.

148
00:09:23,800 --> 00:09:24,630
OK.

149
00:09:24,970 --> 00:09:28,060
So now are actually adding some more lines of code here.

150
00:09:28,060 --> 00:09:35,990
So now as you can see inside this emulator Now you can see that you need to assign the name of the animal

151
00:09:35,990 --> 00:09:38,170
and animal power and animal to speed.

152
00:09:38,170 --> 00:09:38,890
OK.

153
00:09:38,890 --> 00:09:45,990
So here I can just type in the animal name that takes all the animal name value.

154
00:09:46,250 --> 00:09:49,780
Plus as you can see we have an array here.

155
00:09:49,780 --> 00:09:50,620
Animal names.

156
00:09:50,620 --> 00:09:51,100
OK.

157
00:09:51,220 --> 00:09:53,540
So we can just revert to the name of this Aure.

158
00:09:53,800 --> 00:09:54,840
OK.

159
00:09:54,850 --> 00:09:58,970
And inside of this sniffer as you can see animal names.

160
00:09:59,230 --> 00:10:01,930
OK Suppe position.

161
00:10:02,050 --> 00:10:06,880
So as you can see we have this position as an argument of this gets you might get a few Meffert.

162
00:10:07,090 --> 00:10:07,360
OK.

