1
00:00:00,600 --> 00:00:04,520
And now we need to create another handler for this.

2
00:00:04,550 --> 00:00:07,730
But as you can see here inside is uncreate Mefford.

3
00:00:07,870 --> 00:00:09,380
We put this value here.

4
00:00:09,630 --> 00:00:18,750
So now inside this main activity class after the end in calibers of these of these PDT suddenly change

5
00:00:18,750 --> 00:00:20,540
takes water handler.

6
00:00:20,550 --> 00:00:24,310
Now I'm going to actually paste in some lines of code here in this class.

7
00:00:24,480 --> 00:00:29,730
So make sure that you are actually inside this main activity class before this and in Kurla place of

8
00:00:29,730 --> 00:00:33,860
this main activity class and then actually paste in some lines of code here.

9
00:00:34,080 --> 00:00:40,560
So as you can see here these are lines of code that I pasted here and now I'm going to explain to you

10
00:00:40,770 --> 00:00:42,010
what's going on here.

11
00:00:42,030 --> 00:00:43,200
Exactly.

12
00:00:43,200 --> 00:00:49,140
First of all as you can see we have this handler and the access modifier of this handler is private.

13
00:00:49,140 --> 00:00:53,210
This handler is final which means this is actually a constant.

14
00:00:53,610 --> 00:00:59,530
And then as you can see the data type of our handler is actually switchboard dot and see part change

15
00:00:59,550 --> 00:01:01,010
listener interface.

16
00:01:01,260 --> 00:01:01,950
Right.

17
00:01:02,430 --> 00:01:08,530
And the name of our handler is 6 bar savings per cent change the center assignment operator.

18
00:01:08,670 --> 00:01:16,100
And here I am actually creating an anonymous inner class that actually implements this on the part change

19
00:01:16,160 --> 00:01:23,220
in an interface and then it needs to actually implement the methods that are inside of that interface.

20
00:01:23,220 --> 00:01:30,150
So for example we have this unprogressive change team effort on start tracking touch and unstop tracking

21
00:01:30,150 --> 00:01:32,590
touch of which we don't need these.

22
00:01:32,600 --> 00:01:38,010
If it's here in inside our application inside our main activity class but because we are implementing

23
00:01:38,010 --> 00:01:41,910
this on each part change the center interface we need to overwrite them.

24
00:01:42,030 --> 00:01:42,550
OK.

25
00:01:42,780 --> 00:01:45,690
So let's go inside is our progress changed Smurfette.

26
00:01:45,870 --> 00:01:52,230
That actually happens when a user for example is actually working on this switchboard here.

27
00:01:52,230 --> 00:01:52,950
Right.

28
00:01:53,010 --> 00:01:57,720
When I actually see what is actually its value is actually changed.

29
00:01:57,780 --> 00:02:02,700
This method is going to be called on progress changed and this if it accepts free arguments the first

30
00:02:02,700 --> 00:02:07,700
one is C.P.R. as you can see here to see what object that we have here.

31
00:02:07,710 --> 00:02:09,060
The second one is the progress.

32
00:02:09,060 --> 00:02:15,460
So for example when we are sitting on the seat bar it can actually return a value an integer value.

33
00:02:15,600 --> 00:02:19,800
And then we can actually get that value by actually by referring to this argument.

34
00:02:19,860 --> 00:02:21,840
And here we have this from use a boolean.

35
00:02:21,960 --> 00:02:27,870
So it's going to determine whether this sequel is actually changed by the user or it is actually changed

36
00:02:27,870 --> 00:02:29,550
by the logic of the application.

37
00:02:29,550 --> 00:02:31,840
So here for this application we just want to.

38
00:02:32,280 --> 00:02:39,390
Because for this application it doesn't really matter how this argument is being used because when the

39
00:02:39,390 --> 00:02:47,300
user is changing this sick bar we can actually determine how the logic is going to be performed here.

40
00:02:47,310 --> 00:02:50,810
So now let's go inside this unprogressive method here.

41
00:02:50,940 --> 00:02:56,290
And first of all are you referred to the name of this savings per cent variable.

42
00:02:56,460 --> 00:02:57,420
So now let's go inside.

43
00:02:57,420 --> 00:03:03,780
Our main activity class here as you can see I actually created this valuable here inside our class savings

44
00:03:03,790 --> 00:03:07,480
percent assignment operator 0.25.

45
00:03:07,650 --> 00:03:12,270
So I actually created this value bet and the data type of this variable is double double.

46
00:03:12,270 --> 00:03:18,300
And then this this is the value the decimal value that I assigned to this variable initially.

47
00:03:18,300 --> 00:03:25,770
So now as you can see here inside our unprogressive if I actually referred to the name of that valuable

48
00:03:25,770 --> 00:03:27,070
savings percent.

49
00:03:27,210 --> 00:03:31,260
So this variable is going to hold the value of this percent right.

50
00:03:31,470 --> 00:03:32,540
Assignment operator.

51
00:03:32,550 --> 00:03:38,760
So here you referred to the name of this progress here the value that we actually get from this actually

52
00:03:38,760 --> 00:03:43,150
from Sikking is seeking on the seaboard divided by 100.

53
00:03:43,290 --> 00:03:48,800
So this was actually sitting on the seat while you are going to actually get an integer value.

54
00:03:48,900 --> 00:03:53,520
But because we need actually we need to convert that value to a percent.

55
00:03:53,640 --> 00:03:59,820
We need to devote that value by 100 so that we get actually a person's value and then we can assign

56
00:03:59,820 --> 00:04:02,070
that value to the savings percent.

57
00:04:02,070 --> 00:04:10,140
So now we have the savings percent and now I would actually create another Meffert in order to calculate

58
00:04:10,140 --> 00:04:10,870
the savings.

59
00:04:10,970 --> 00:04:11,470
OK.

60
00:04:11,640 --> 00:04:16,730
We need to calculate the savings according to the salary that they use if for example enters inside

61
00:04:16,730 --> 00:04:24,480
this it Etisalat here and then according to this search bar for example the user wants to save 30 percent

62
00:04:24,720 --> 00:04:28,520
income and then we can actually Chatroulette is money saved here.

63
00:04:28,860 --> 00:04:38,130
So now after the end in curly brace of this listen of this handler here I am actually pasting some lines

64
00:04:38,130 --> 00:04:43,620
of code here in say this main activity class and then I'm going to explain to you what's going on here.

65
00:04:43,650 --> 00:04:44,700
Exactly.

66
00:04:44,700 --> 00:04:49,910
So as you can see here these are the lines of code that I pasted here.

67
00:04:50,160 --> 00:04:56,220
And as you can see the access modify of this method is actually private the return type of this method

68
00:04:56,220 --> 00:05:01,500
is Voyt and the name of the Smif it is calculated savings right.

69
00:05:01,640 --> 00:05:04,120
And this method actually accepts no arguments.

70
00:05:04,190 --> 00:05:09,230
So let's go inside the curly braces of the Smurfette Let's go inside the body of this Meffert And let's

71
00:05:09,230 --> 00:05:10,890
see what's going on here.

72
00:05:10,910 --> 00:05:15,770
First of all I am actually setting the text of this text the same person.

73
00:05:15,890 --> 00:05:21,500
So now if you look at this your here if you look at our application here I am actually setting the text

74
00:05:21,560 --> 00:05:28,440
of this to the safe percent so excessive percent of set text per cent format's value that format.

75
00:05:28,670 --> 00:05:33,560
So here we are referring to it to our person formats about objects that we actually created inside our

76
00:05:33,830 --> 00:05:36,580
main activity class in life 16 as you can see here.

77
00:05:36,620 --> 00:05:44,120
I created this object is in order to actually get the specific format of actually of the person character

78
00:05:44,150 --> 00:05:48,610
according to the specific locale in the user's device.

79
00:05:48,710 --> 00:05:49,530
Right.

80
00:05:49,580 --> 00:05:55,750
So that's why I actually created this object per person format's value that format saving's percent.

81
00:05:55,760 --> 00:06:01,640
So again I'll refer to the name of this valuable that actually holds the value of the person.

82
00:06:01,640 --> 00:06:06,560
So for example when the user is actually C-Change on the search bar that this value is going to hold

83
00:06:06,560 --> 00:06:08,430
that value by percent.

84
00:06:08,840 --> 00:06:14,930
And then here we are again setting the stage see the setting is the text of this thing is a percent

85
00:06:15,680 --> 00:06:17,830
actually referring to the name of that variable.

86
00:06:18,170 --> 00:06:24,930
So now here in line 212 as you can see we created another variable which is of type double.

87
00:06:25,250 --> 00:06:27,900
And the name of this value that is saved money.

88
00:06:27,920 --> 00:06:28,370
OK.

89
00:06:28,490 --> 00:06:34,300
So it's going to calculate the savings according to the use of a salary and how much he wants.

90
00:06:34,340 --> 00:06:40,910
He or she wants to actually save his or her income and then it's going to actually hold this value so

91
00:06:40,910 --> 00:06:44,110
double saved money assignment operator.

92
00:06:44,270 --> 00:06:48,250
So as you can see here we have an operation here inside the parentheses.

93
00:06:48,320 --> 00:06:54,050
So here because there is only one operation we can actually eliminate these practices as you can see

94
00:06:54,050 --> 00:06:54,770
here.

95
00:06:55,100 --> 00:06:56,990
So total salary.

96
00:06:56,990 --> 00:07:02,570
So here you referred to the name of the salary to the value that that the user actually assigned to

97
00:07:02,570 --> 00:07:03,950
the as it takes here.

98
00:07:03,950 --> 00:07:10,820
So if you look at this say this main activity class I actually created this total salary here inside

99
00:07:10,850 --> 00:07:18,010
this class and inside the Smurfette insight is actually EDT salary change takes to watcher.

100
00:07:18,230 --> 00:07:25,160
And inside these on takes change method here as you can see I am assigning the value that the user is

101
00:07:25,160 --> 00:07:30,280
actually enter is entering into this text right here.

102
00:07:30,290 --> 00:07:31,860
I am actually getting disvalue here.

103
00:07:31,880 --> 00:07:35,010
I am actually converting this value to a string value.

104
00:07:35,030 --> 00:07:39,870
And then here I am converting this value to a double value and then we can assign that value to the

105
00:07:39,890 --> 00:07:41,900
total salary value.

106
00:07:42,140 --> 00:07:43,110
Right.

107
00:07:43,130 --> 00:07:46,430
So let's go back to our calculate saving method here.

108
00:07:46,430 --> 00:07:48,080
So total salary.

109
00:07:48,330 --> 00:07:51,250
Multiply it by savings percent.

110
00:07:51,260 --> 00:07:55,460
So in this way we can actually get the value.

111
00:07:55,640 --> 00:08:01,130
Actually the amount of money that the user wants to save and then we can actually assign that value

112
00:08:01,130 --> 00:08:02,310
to the saved money.

113
00:08:02,630 --> 00:08:09,080
OK so total salary multiplied by savings percent this value that the user enters inside is ediface multiplied

114
00:08:09,080 --> 00:08:11,720
by the value that the user for example wants to save.

115
00:08:11,720 --> 00:08:16,070
For example 30 percent or 50 percent or 100 percent.

116
00:08:16,280 --> 00:08:22,880
And then now as you can see by multiplying these two values together we can achieve the save the money

117
00:08:23,690 --> 00:08:24,350
and in line.

118
00:08:24,350 --> 00:08:29,480
Two hundred and fourteen Here now is the time to actually set the text of the stakes here.

119
00:08:29,630 --> 00:08:34,790
So th the money saved that's a text currency format value that format.

120
00:08:34,820 --> 00:08:40,640
And again we created this object currency format's value inside our main activity class here as you

121
00:08:40,640 --> 00:08:49,120
can see in order to get to the specific format of the value that is actually specific to the split locale

122
00:08:49,640 --> 00:08:52,270
that is inside of the user's device.

123
00:08:52,280 --> 00:08:53,010
Okay.

124
00:08:53,210 --> 00:09:00,370
So now here currency format value does for them and save the money as you can see here.

125
00:09:00,710 --> 00:09:05,530
So here now we can actually as scientists save the money to this takes a view here.

126
00:09:05,990 --> 00:09:13,640
So now we need to actually call this method here inside our first of what insight is on progress changed

127
00:09:13,970 --> 00:09:18,440
Mefford that is inside of this handler inside of these anonymous inner class.

128
00:09:18,440 --> 00:09:22,820
So after this line of thought here inside is unprogressive imperfect we need to actually just call this

129
00:09:22,820 --> 00:09:31,630
calculate savings here and here after this line of code here inside these on takes the change Smurfette.

130
00:09:31,700 --> 00:09:37,840
For example when the user enters a value here I just need to put these Meffert here Chad Chatroulette

131
00:09:38,060 --> 00:09:42,410
savings and in this way we can actually calculate the savings.

132
00:09:42,700 --> 00:09:47,200
And now it's time to actually run our project and see what happens.

133
00:09:47,420 --> 00:09:50,920
So here as you can see our application is running on this emulator.

134
00:09:51,020 --> 00:09:54,770
So now you want to assign a value here into these EDT salary.

135
00:09:54,800 --> 00:09:58,820
So for example the user ends five thousand dollars a month.

136
00:09:59,030 --> 00:09:59,600
Right.

137
00:09:59,930 --> 00:10:07,910
So now let me actually disappear this keyboard here and now as you can see if the user wants to save

138
00:10:07,910 --> 00:10:13,870
25 percent of his or her income this is the value that is actually saved.

139
00:10:14,180 --> 00:10:14,930
Right.

140
00:10:14,960 --> 00:10:21,540
So all the user for example wants to save 50 percent of his or her income.

141
00:10:21,580 --> 00:10:23,710
This is the value that the user should save.

142
00:10:24,800 --> 00:10:32,090
Write or if the user wants to for example save 100 percent of his or her income this is the value that

143
00:10:32,090 --> 00:10:33,580
the user should save.

144
00:10:34,070 --> 00:10:36,070
So hopefully that makes sense.

145
00:10:36,500 --> 00:10:40,680
And this is actually a completely perfect application.

146
00:10:40,760 --> 00:10:46,910
You can work on this application or you can actually for example put a scroll view here and then you

147
00:10:46,910 --> 00:10:53,930
can put some other some lots of different actually calculators inside that scroll view and then you

148
00:10:53,930 --> 00:10:56,670
can actually put your own logic here.

149
00:10:57,200 --> 00:11:03,580
And then you can just uploaded this application to the Google Play store and make application your own.

150
00:11:03,950 --> 00:11:09,680
So thank you very much for watching and hopefully this application was very helpful to you.

151
00:11:09,680 --> 00:11:15,730
I actually got lots of and lots of different features of Android to you.

152
00:11:15,830 --> 00:11:21,220
So make sure to work on these skills and make sure to master these skills that I taught you in this

153
00:11:21,230 --> 00:11:22,180
tutorial.

154
00:11:22,490 --> 00:11:23,700
Thank you very much for watching.

155
00:11:23,720 --> 00:11:29,610
And by the way if you have any questions about the concepts that I actually caught you in the lesson

156
00:11:29,810 --> 00:11:35,420
please post the discussion in the course and then I'll do my best to answer all of your questions.

157
00:11:35,420 --> 00:11:38,910
Again thank you very much for watching and I'll see you in the next year Tauriel.

