1
00:00:00,330 --> 00:00:02,850
So now I'm going to paste in some lines of code here.

2
00:00:02,850 --> 00:00:04,590
Inside is uncreate Meffert.

3
00:00:04,770 --> 00:00:08,240
And then I'm going to explain to you what's going on here.

4
00:00:08,700 --> 00:00:14,730
So as you can see here these are lines of code that I pasted here first about in line for 88.

5
00:00:14,730 --> 00:00:20,400
I want to I try to initialize this takes the bill amount object which is of the view that I declared

6
00:00:20,460 --> 00:00:21,730
in line 18.

7
00:00:21,750 --> 00:00:22,570
As you can see here.

8
00:00:22,590 --> 00:00:23,710
So to the amount.

9
00:00:23,730 --> 00:00:30,060
Assignment operator and then here I am actually testing this object to a text view object find view

10
00:00:30,060 --> 00:00:32,330
by id r that ID that 8:36 to be the mount.

11
00:00:32,370 --> 00:00:37,710
So I actually deferred to the ID of this the bill amount takes a.

12
00:00:38,070 --> 00:00:43,140
And here in line 39 am initialising 66 percent assignment operator error.

13
00:00:43,290 --> 00:00:49,830
Here I am casting this object which takes a few object find your way Id are that ID that 80 percent.

14
00:00:49,950 --> 00:00:53,040
And here we have this the tip assignment operator.

15
00:00:53,190 --> 00:00:58,940
Again I am casting this object which takes few object point view by ID or that ID that X the type.

16
00:00:58,950 --> 00:01:03,090
Here you have you are actually initializing this takes the total amount.

17
00:01:03,120 --> 00:01:09,890
And here again as you can see find your way Id are that ID that takes the total amount and in line 43

18
00:01:09,910 --> 00:01:13,030
here I am actually setting the text of this tip.

19
00:01:13,130 --> 00:01:20,070
So the tip that it takes and here inside Apprentice's of this text Mefford I actually referred to the

20
00:01:20,070 --> 00:01:27,550
name of this currency format value object as you can see here currency format value object data format.

21
00:01:27,660 --> 00:01:34,000
So it's going to actually format this value that we pass to this format Meffert despite the number 0

22
00:01:34,300 --> 00:01:41,010
and it's going to actually return a string value of that specific format that is specific to that locale.

23
00:01:41,010 --> 00:01:42,930
Here for example four different countries.

24
00:01:42,930 --> 00:01:50,430
It depends on the settings of the users the price that which actually which locale is actually used

25
00:01:50,880 --> 00:01:52,290
for that specific device.

26
00:01:52,290 --> 00:01:57,630
So it's going to actually turn up a specific value for that specific locale currency format value that

27
00:01:57,630 --> 00:02:01,270
format number 0 is going to actually return a string value.

28
00:02:01,530 --> 00:02:02,240
OK.

29
00:02:02,610 --> 00:02:08,700
And then add the total bill amount here that said text again I actually referred to the name of this

30
00:02:08,700 --> 00:02:13,190
currency for value object that form at number zero.

31
00:02:13,710 --> 00:02:19,350
Let's actually look at these lines of Cahir in line 46 I am initialising this TXI is safe.

32
00:02:19,340 --> 00:02:20,210
Percent.

33
00:02:20,490 --> 00:02:27,630
OK this is to say percent object which I actually declared here a line at twenty five as you can see

34
00:02:27,630 --> 00:02:28,270
here.

35
00:02:28,530 --> 00:02:34,550
So Th to say person assignment operator here I am casting this object to a text object find view by

36
00:02:34,560 --> 00:02:38,310
ID or that ID that is to say for ascent in line 4 to 7.

37
00:02:38,310 --> 00:02:43,990
I am actually initialized this takes the money saved object assignment operator takes you find view

38
00:02:44,000 --> 00:02:51,520
way id or ID that actually takes the money saved and in 949 I am actually setting the text of this 360

39
00:02:51,570 --> 00:02:52,640
the money saved.

40
00:02:52,900 --> 00:02:58,390
That takes the currency format value as you can see here again that format number 0.

41
00:02:58,410 --> 00:03:03,900
So that is actually on our project here in order to show you some of these changes on the screen on

42
00:03:03,900 --> 00:03:05,270
the emulator.

43
00:03:05,280 --> 00:03:08,860
So here as you can see our application is running on the simulator.

44
00:03:09,090 --> 00:03:15,420
And here you can see that the value of this tip is the tip as you can see here actually to set the text

45
00:03:15,420 --> 00:03:17,040
of the text to keep in line.

46
00:03:17,060 --> 00:03:20,100
Our first Iffley currency format that format number zero.

47
00:03:20,100 --> 00:03:22,670
So here you can see we have this value.

48
00:03:22,710 --> 00:03:26,100
So the locale of my emulator is actually us.

49
00:03:26,220 --> 00:03:32,100
So we have this dollar sign here dollar sign 0.00 which is actually at our table about you as you can

50
00:03:32,100 --> 00:03:37,290
see here and here I actually said this takes the total amount.

51
00:03:37,530 --> 00:03:39,180
This is the total amount.

52
00:03:39,210 --> 00:03:46,650
Again we have this dollar sign zero point zero zero and now we can see that 11:49 actually set the takes

53
00:03:46,650 --> 00:03:50,640
of this takes the money saved currency from value that format number zero.

54
00:03:50,640 --> 00:03:54,460
So here you can see this value dollar signs zero point zero zero.

55
00:03:54,690 --> 00:03:55,680
Right.

56
00:03:55,680 --> 00:04:01,590
So that's the job of this currency format value in order to actually give us the specific format of

57
00:04:02,100 --> 00:04:05,310
that is actually suitable for that specific locale.

58
00:04:05,820 --> 00:04:07,560
So hopefully that makes sense.

59
00:04:07,830 --> 00:04:12,930
And now we're actually pasting some more lines of code here inside this uncreate Mefford and then I'm

60
00:04:12,930 --> 00:04:15,740
going to explain to you what's going on here.

61
00:04:15,930 --> 00:04:20,200
So here inside this uncreate method before I actually add the logic.

62
00:04:20,550 --> 00:04:27,490
First let me tell you that first of all I want to actually add the logic in order to in order for this

63
00:04:28,620 --> 00:04:30,190
calculator to work.

64
00:04:30,360 --> 00:04:30,870
Okay.

65
00:04:31,080 --> 00:04:33,870
And then I add the logic for the savings calculator.

66
00:04:33,870 --> 00:04:34,260
Okay.

67
00:04:34,380 --> 00:04:37,010
First I want this tip calculator here.

68
00:04:37,260 --> 00:04:39,760
So now I'm going to paste in some lines of code here.

69
00:04:40,080 --> 00:04:44,810
As you can see here these are the lines of code that I pasted here in line 55.

70
00:04:45,030 --> 00:04:51,670
I actually created an object of type edit takes and the name of my object is the amount of the text.

71
00:04:51,690 --> 00:04:52,270
Right.

72
00:04:52,290 --> 00:04:57,540
So as you can see here these are the lines of code that I pasted here inline 55.

73
00:04:57,570 --> 00:05:00,180
I actually created an object of type editor.

74
00:05:00,480 --> 00:05:03,240
And the name of my object is EDT money amount.

75
00:05:03,290 --> 00:05:04,060
Right.

76
00:05:04,170 --> 00:05:10,560
Assignment operator and then here I Chastity's object to a test object find view ID or that ID that

77
00:05:10,620 --> 00:05:11,670
it is the money amount.

78
00:05:11,670 --> 00:05:14,550
So let's actually show you the application of the emulator.

79
00:05:14,730 --> 00:05:21,870
So here I am actually referring to this ID tastier and helping out here as you can see here it is the

80
00:05:21,870 --> 00:05:23,010
money amount.

81
00:05:23,270 --> 00:05:28,830
And now in 56 you can see something different here which you haven't seen so far.

82
00:05:29,130 --> 00:05:35,810
It's the money amount I actually referred to the name of this eddy takes object that add text change

83
00:05:35,830 --> 00:05:36,650
listener.

84
00:05:36,950 --> 00:05:37,440
OK.

85
00:05:37,620 --> 00:05:42,120
So I want to actually make this it it takes actually a listener.

86
00:05:42,350 --> 00:05:42,790
OK.

87
00:05:42,910 --> 00:05:48,450
A listener to what a listener to the changes that is actually happening on this editor.

88
00:05:48,450 --> 00:05:55,170
So if the user for example adds some values into these added text or if the user removes those values

89
00:05:55,170 --> 00:06:00,440
from the edit text or this edit takes here it's going to be aware of those changes.

90
00:06:00,570 --> 00:06:06,820
So here that's why I actually referred to the name of this edit text EDT money amount that ad takes

91
00:06:06,820 --> 00:06:08,230
to change the listener.

92
00:06:08,400 --> 00:06:14,130
So this edits is going to be the listener for those changes is going to actually listen to those changes

93
00:06:14,130 --> 00:06:18,660
that actually happened that actually occur inside these edit text.

94
00:06:18,810 --> 00:06:23,750
And it's great that that editing is going to be a of of a lot of those changes.

95
00:06:23,820 --> 00:06:26,990
And here I assign this value this is actually a handler.

96
00:06:27,000 --> 00:06:27,370
OK.

97
00:06:27,450 --> 00:06:32,270
That actually allowed this edit takes to be aware of those changes.

98
00:06:32,280 --> 00:06:38,290
So now we need to actually define this handler and then let's actually show you this line.

99
00:06:38,340 --> 00:06:39,450
Fifty eight.

100
00:06:39,450 --> 00:06:45,440
Here I am actually again creating an object of type search bar and the name of this object is sick but

101
00:06:45,480 --> 00:06:46,760
person's right.

102
00:06:46,770 --> 00:06:52,350
So here I am actually defining the search bar here an assignment operator here I am actually casting

103
00:06:52,740 --> 00:06:58,920
the object to a search object find your ID or that ID search bar percent.

104
00:06:58,920 --> 00:07:06,150
As you can see here I am actually defining this object here and in line 59 or is referred to the name

105
00:07:06,150 --> 00:07:10,890
of this Seeburg percent object that set on Skipworth change listener.

106
00:07:10,890 --> 00:07:17,850
So here I am 5:42 but a listener to actually these changes when they use it for example changes this

107
00:07:18,180 --> 00:07:22,200
value of these Sebald or when the user seeks on this Seaboard.

108
00:07:22,260 --> 00:07:26,190
This part is going to listen to those changes and then it's going to respond.

109
00:07:26,310 --> 00:07:28,450
So here I actually add this value here.

110
00:07:28,460 --> 00:07:32,520
This handler and Vinita defined his handler in our class.

111
00:07:32,760 --> 00:07:36,150
But as you can see the name of this handler is Tepes each part change the center.

112
00:07:36,190 --> 00:07:41,610
So this handle it is going to allow the search bar to be aware of actually of these changes.

113
00:07:41,610 --> 00:07:41,880
Right.

114
00:07:41,880 --> 00:07:44,920
Of actually seeking this the here.

115
00:07:44,940 --> 00:07:50,580
So first of all it's actually defined this a cheap ADT money amount it takes to watch her handler.

116
00:07:50,580 --> 00:07:56,780
So let's actually go inside this class after the end in calibrates of this and method.

117
00:07:57,000 --> 00:08:03,060
And inside the main activity class and what I'm going to actually pastings some lines of code here and

118
00:08:03,060 --> 00:08:06,100
then I'm going to explain to you what's going on here.

119
00:08:06,330 --> 00:08:13,640
So now let me actually define this handler here manually and then because I want to show you RDL actually

120
00:08:13,640 --> 00:08:15,230
a very important point.

121
00:08:15,450 --> 00:08:20,000
So now private's the access modify it up this handler is private.

122
00:08:20,340 --> 00:08:23,040
And this is actually a constant private final.

123
00:08:23,460 --> 00:08:31,800
And that data type of this handler is actually text Wotcher text Wotcher and the name of this handler

124
00:08:31,800 --> 00:08:33,580
is going to be the value that I put here.

125
00:08:33,610 --> 00:08:39,780
Tepe EDT money amount text whatever so I just copy this value here and paste it here.

126
00:08:39,780 --> 00:08:43,190
Assignment operator new text.

127
00:08:43,440 --> 00:08:49,380
And as you can see here as I actually typed t it the autocomplete feature of the Android studio is helping

128
00:08:49,380 --> 00:08:52,500
me to actually choose this text which are here as you can see.

129
00:08:52,500 --> 00:08:55,540
So just select it and press an interviewee on your keyboard.

130
00:08:56,130 --> 00:09:01,600
And now the Android studio Id actually put these lines of code here automatically.

131
00:09:01,800 --> 00:09:07,140
So first let me actually as you can see we have an error here and at the end of these this calibrates

132
00:09:07,380 --> 00:09:11,370
as you can see if you need to put a semicolon here and now the error is gone.

133
00:09:11,370 --> 00:09:15,440
And these are the methods that are actually put here by the Android studio.

134
00:09:15,660 --> 00:09:18,420
These are the same effects that we need to overwrite.

135
00:09:18,660 --> 00:09:26,310
So as I told you before when you actually create a handler or an interface you are actually creating

136
00:09:26,580 --> 00:09:33,370
an anonymous inner class here and that in a class is actually implementing this text watcher interface.

137
00:09:33,480 --> 00:09:34,190
Right.

138
00:09:34,230 --> 00:09:39,490
And as you can see here these are the methods that that in a class that anonymous class that we can

139
00:09:39,490 --> 00:09:45,810
see that the name of that class here that in a class is actually implementing these methods.

140
00:09:45,880 --> 00:09:51,970
And let me tell you that anonymously in all classes but actually classes without names.

141
00:09:52,050 --> 00:09:52,690
Right.

142
00:09:52,740 --> 00:09:58,530
So this class that actually have no names here is is actually implementing these methods that are actually

143
00:09:58,530 --> 00:10:02,690
related to the sponsor interface and here we can actually use these methods.

144
00:10:02,760 --> 00:10:06,560
First of all we have this Smurfit public void before text changed.

145
00:10:06,570 --> 00:10:09,210
So we're not going to use this method here in this application.

146
00:10:09,210 --> 00:10:13,940
And this is going to be executed before the value of this.

147
00:10:13,950 --> 00:10:16,590
For example let me show you on this emulator.

148
00:10:16,710 --> 00:10:22,610
This Meffert this before text change here is going to be executed before they use it as any values to

149
00:10:22,650 --> 00:10:28,820
these it takes here all the use that is about to add an R values to these inside these edit text.

150
00:10:28,890 --> 00:10:32,810
So we're not going to use this method here and we have an exchange.

151
00:10:32,820 --> 00:10:38,160
So this method is going to be executed when the user is actually adding or removing values into these

152
00:10:38,370 --> 00:10:39,120
edit text.

153
00:10:39,210 --> 00:10:40,120
As you can see here.

154
00:10:40,270 --> 00:10:43,930
So this is the method that you're going to work inside our application.

155
00:10:43,950 --> 00:10:47,340
This is a very important Smurfette and we need to use this method.

156
00:10:47,370 --> 00:10:52,460
And we are going to actually put our logic inside the Smurfit and the last it is the Smurfette after

157
00:10:52,470 --> 00:10:53,500
text changed.

158
00:10:53,760 --> 00:10:58,940
So this is going to be executed after the values of these tests actually changed.

159
00:10:59,100 --> 00:11:02,990
Finally and we can actually put a logic here in order to execute.

160
00:11:03,210 --> 00:11:07,890
But the most important method here is the Smurfette on takes changed.

161
00:11:07,890 --> 00:11:12,440
So let's actually go inside the Smurfette and now I'm going to paste in some lines of code here.

162
00:11:12,450 --> 00:11:16,270
Inside the Smurfette and then I'm going to explain to you what's going on here.

