1
00:00:00,850 --> 00:00:04,830
So here as you can see our application is running on the emulator.

2
00:00:05,210 --> 00:00:10,580
So now let's actually assign a value for this and Bill amount for example one hundred.

3
00:00:10,930 --> 00:00:19,210
And now as you can see the tip is $25 and the total is 125 because here we specified that the percent

4
00:00:19,330 --> 00:00:20,740
is going to be 25 percent.

5
00:00:20,830 --> 00:00:25,420
So I can actually change this value to another value for example 10 percent.

6
00:00:25,880 --> 00:00:31,930
And as you can see here these values are changing the tip is now $10 and the total value that the user

7
00:00:31,930 --> 00:00:35,480
should pay is actually $110 right.

8
00:00:35,500 --> 00:00:37,340
So hopefully this makes sense.

9
00:00:37,400 --> 00:00:42,160
And now let's actually vote on our savings calculator here.

10
00:00:42,190 --> 00:00:50,410
So now let's go back to our jobs file here and now as you can see I actually created these valuables

11
00:00:50,410 --> 00:00:54,480
here inside our main activity class for example in line 24/7.

12
00:00:54,490 --> 00:00:58,130
We have this valuable which is of type double total salary.

13
00:00:58,270 --> 00:01:04,050
So this total salary is going to be the salary here that the user assigned is what you hear right.

14
00:01:04,090 --> 00:01:08,430
And here we have these savings percent as you can see here.

15
00:01:08,710 --> 00:01:14,170
So these savings percent variable which is of type double is going to actually hold the value of this

16
00:01:14,170 --> 00:01:14,900
percent.

17
00:01:15,100 --> 00:01:20,710
So when the user actually sits on the search bar it is going to actually change the value of this percent

18
00:01:21,070 --> 00:01:23,340
and then we can actually save that value.

19
00:01:23,350 --> 00:01:27,770
We can hold that value here inside this savings percent variable.

20
00:01:28,150 --> 00:01:34,330
And according to these savings percent and according to the salary that the user enters here we can

21
00:01:34,330 --> 00:01:39,590
actually calculate the value or the money that the user is actually saving.

22
00:01:39,700 --> 00:01:39,940
OK.

23
00:01:39,940 --> 00:01:41,830
Or the use that one to save.

24
00:01:41,890 --> 00:01:42,770
Right.

25
00:01:42,820 --> 00:01:45,460
So this is going to be our savings calculator.

26
00:01:45,460 --> 00:01:51,390
So we have this total salary savings present and we have to take suffuse for this first.

27
00:01:51,430 --> 00:01:56,210
The first one is for this save a person here this person here.

28
00:01:56,410 --> 00:01:58,570
And the second one is takes the money saved.

29
00:01:58,810 --> 00:02:02,720
And the second one is for this actually takes few here as you can see.

30
00:02:02,980 --> 00:02:10,180
So now first of all let's go inside this uncreate method here and after these lines of code here as

31
00:02:10,180 --> 00:02:17,950
you can see we have two handlers for actually this takes edited out and we have another handler for

32
00:02:17,950 --> 00:02:19,320
this sequel person.

33
00:02:19,480 --> 00:02:23,490
So we need two more handlers inside this uncreate Mefford.

34
00:02:23,680 --> 00:02:29,050
So now I'm going to pace seen some lines of code here and then I'm going to explain to you what's going

35
00:02:29,050 --> 00:02:30,430
on here.

36
00:02:30,460 --> 00:02:35,050
So as you can see here these are lines of code that I pasted here.

37
00:02:35,080 --> 00:02:41,920
First of all I created this line of code here as you can see I created an object of type a text.

38
00:02:42,310 --> 00:02:49,390
And this time the name of my editor is actually his salary so he had to actually create an object for

39
00:02:49,470 --> 00:02:54,690
this as he takes here as you can see here it is salary so assignment operator.

40
00:02:54,940 --> 00:03:03,100
And here I am actually testing this object to an edit text object find view by ID or that ID that it

41
00:03:03,140 --> 00:03:03,830
salary.

42
00:03:03,880 --> 00:03:04,990
Right.

43
00:03:05,080 --> 00:03:07,880
And here in line 66 it salary.

44
00:03:07,900 --> 00:03:13,750
So here I actually referred to the name of this edited edit text object it itself essentially that takes

45
00:03:13,780 --> 00:03:14,900
change listener.

46
00:03:15,100 --> 00:03:20,680
So here I want to actually make this less this it takes actually a listener.

47
00:03:20,800 --> 00:03:21,300
OK.

48
00:03:21,400 --> 00:03:29,460
To what happens inside these edits for example when the users at or actually move some values from this

49
00:03:29,470 --> 00:03:30,120
editor.

50
00:03:30,310 --> 00:03:35,560
You want to actually know what's going on here we want these it takes to be aware of what's happening

51
00:03:35,560 --> 00:03:36,970
inside these text.

52
00:03:37,240 --> 00:03:40,070
So that's why they actually put this line of code here.

53
00:03:40,240 --> 00:03:43,170
It is clearly that add text change to listener.

54
00:03:43,390 --> 00:03:46,040
And here as you can see I actually put this value here.

55
00:03:46,060 --> 00:03:47,670
It is decidedly changed.

56
00:03:47,720 --> 00:03:54,540
KC's watcher so this is going to be the name of our handler which we haven't actually put this.

57
00:03:54,760 --> 00:03:58,120
We haven't actually defined it is handler here.

58
00:03:58,190 --> 00:04:05,950
Yet inside our class and here in line 68 as you can see I actually created an object of type search

59
00:04:05,950 --> 00:04:13,210
bar and the name of my object is search bar save percent assignment operator.

60
00:04:13,630 --> 00:04:21,190
And then here I am actually testing this object to a simple object find view by ID or that ID that seach

61
00:04:21,200 --> 00:04:23,820
part save percent as you can see here.

62
00:04:23,980 --> 00:04:26,060
So here let me disappear.

63
00:04:26,070 --> 00:04:30,700
This virtual keyboard here as you can see we have this part here right.

64
00:04:30,700 --> 00:04:36,430
So here I created an object of type each part and then I referred to the ID of these people here.

65
00:04:36,790 --> 00:04:44,910
So in 1969 here I refer to the name of our object seek birthday present that said unsichtbare chain

66
00:04:44,960 --> 00:04:46,030
to the center.

67
00:04:46,030 --> 00:04:47,740
So again I want to be aware.

68
00:04:47,770 --> 00:04:54,370
I want to actually know what the what is going to be the value of this Sebarenzi use that actually seeks

69
00:04:54,430 --> 00:04:55,940
on the part here.

70
00:04:56,050 --> 00:04:56,670
Right.

71
00:04:56,710 --> 00:05:02,930
So that's why I actually put this line of code here such Percy percent that set on six part change the

72
00:05:02,940 --> 00:05:03,430
center.

73
00:05:03,650 --> 00:05:10,330
And that I actually put this value here in this name so bar savings percent change listener.

74
00:05:10,520 --> 00:05:13,200
So this is going to be again the name of our handler.

75
00:05:13,460 --> 00:05:17,720
So first of all let's actually create this handler and then we're going to go ahead and create this

76
00:05:17,720 --> 00:05:18,810
handler here.

77
00:05:19,130 --> 00:05:26,300
So now as you can see let's actually scroll down here and after.

78
00:05:26,540 --> 00:05:31,940
And as you can see here inside this class inside is main activity class and before the end in calibers

79
00:05:32,030 --> 00:05:37,090
of this main activity class here as you can see we're going to actually put our own code here.

80
00:05:37,370 --> 00:05:47,750
So now let me create a comment savings person savings calculator logic OK.

81
00:05:47,970 --> 00:05:53,160
So here I got a pasting sometimes some lines of code here and then I'm going to explain to you what's

82
00:05:53,160 --> 00:05:54,650
going on here.

83
00:05:55,140 --> 00:06:01,620
So as you can see here these are the lines of code that I pasted here and now I'm going to actually

84
00:06:01,620 --> 00:06:03,900
explain to you what's going on here.

85
00:06:03,930 --> 00:06:05,220
Exactly.

86
00:06:05,220 --> 00:06:10,980
First of all as you can see we have this private access modifier and we have to find out which which

87
00:06:10,980 --> 00:06:17,610
means that this is actually a constant and the data type of a handler is actually the text Wotcher and

88
00:06:17,610 --> 00:06:25,350
the name of our handler is EDT salary changed text bocher the same name that you specify here inside

89
00:06:25,350 --> 00:06:26,940
this uncreate method.

90
00:06:26,940 --> 00:06:30,550
Here as you can see it is Elodie changed text watcher.

91
00:06:30,870 --> 00:06:32,870
So let's go back to our handler here.

92
00:06:33,000 --> 00:06:36,810
So assignment operator new text watcher.

93
00:06:37,040 --> 00:06:43,560
OK so now it's going to actually create an anonymous inner class and that anonymous class is going to

94
00:06:43,560 --> 00:06:52,820
actually implement these text watcher interface and then it is going to actually implement these methods.

95
00:06:52,830 --> 00:06:57,860
These are abstract methods that are inside these texts which are in interface.

96
00:06:57,870 --> 00:07:03,270
So now if we actually hold the comments on my keyboard or the if you are using a Windows machine you

97
00:07:03,270 --> 00:07:05,520
need to hold the control key on your keyboard.

98
00:07:05,820 --> 00:07:12,010
And then I just click on the states which are here as you can see this is actually an interface right.

99
00:07:12,090 --> 00:07:18,680
And here we have some methods inside this interface as you can see here before text changed on text

100
00:07:18,690 --> 00:07:21,630
change and after the text changed.

101
00:07:21,630 --> 00:07:22,560
Right.

102
00:07:22,560 --> 00:07:26,570
So these are the facts that are inside this text which are inside the interface.

103
00:07:26,820 --> 00:07:29,590
So let's go back to our main activity file here.

104
00:07:29,850 --> 00:07:34,000
So now these are them if it's before the exchange so we don't need that for here.

105
00:07:34,290 --> 00:07:36,620
And here is our Meffert on takes changed.

106
00:07:36,630 --> 00:07:42,330
We use this method here and we also don't use this after taste change year aftertaste change Meffert

107
00:07:42,360 --> 00:07:43,410
you're right.

108
00:07:43,560 --> 00:07:50,370
So now let's go inside this text change method and here as you can see I have this try catch block here.

109
00:07:50,730 --> 00:07:52,100
And here's try.

110
00:07:52,320 --> 00:07:54,980
So let's go inside the curly braces of destroy black.

111
00:07:55,170 --> 00:08:01,210
And here are you referred to the name of this variable that I created inside this main activity class.

112
00:08:01,230 --> 00:08:06,240
So let's go back to our class here as you can see I actually created this variable here.

113
00:08:06,240 --> 00:08:07,550
This variable is of type double.

114
00:08:07,560 --> 00:08:11,300
And then I assigned this value zero point zero to the value of it.

115
00:08:11,400 --> 00:08:16,130
So now here are you referring to the name of that variable assignment operator.

116
00:08:16,380 --> 00:08:21,710
And then you refer to the name of this double class that parse double.

117
00:08:21,720 --> 00:08:27,570
So I actually called this parse double method on this double class so this is actually this method is

118
00:08:27,780 --> 00:08:29,090
actually a static method.

119
00:08:29,100 --> 00:08:29,880
Right.

120
00:08:30,000 --> 00:08:34,820
And this method actually accepts an argument of pipe string.

121
00:08:35,100 --> 00:08:41,790
So then it's going to actually convert that string value to a integer value or double value as you can

122
00:08:41,790 --> 00:08:42,690
see here.

123
00:08:42,690 --> 00:08:49,170
Double the pulse double if you wanted to use Integer instead of double we needed to actually call integer

124
00:08:49,230 --> 00:08:50,490
that parse integer.

125
00:08:50,520 --> 00:08:55,980
Right but here it's going to actually convert this string value to a double value.

126
00:08:56,070 --> 00:09:01,150
And here in say the apprentices as you can see here refers to the name of this argument that we receive

127
00:09:01,200 --> 00:09:05,640
from this text change method so s that is 3.

128
00:09:05,640 --> 00:09:09,000
So as you can see here this argument is of type chart sequence right.

129
00:09:09,030 --> 00:09:12,070
So we need to convert that value to a string value.

130
00:09:12,300 --> 00:09:19,080
And as I told you before this value is actually the value that we actually assign to these Eadie text.

131
00:09:19,080 --> 00:09:19,350
Right.

132
00:09:19,350 --> 00:09:22,310
For example number two number three or other values.

133
00:09:22,500 --> 00:09:25,440
This is going to be this is which is off the chart sequence.

134
00:09:25,440 --> 00:09:28,590
And here we are actually converting that by twisting value.

135
00:09:28,830 --> 00:09:34,290
And here by using these parts double Methody are converting that string value to a double value.

136
00:09:34,290 --> 00:09:38,290
And then we can assign that double value to this total salary.

137
00:09:38,540 --> 00:09:44,040
And here as you can see we have this catch plug here and this church is going to actually catch the

138
00:09:44,040 --> 00:09:48,530
errors that are actually number format exception as you can see here.

139
00:09:48,750 --> 00:09:53,930
So for example the user might assign a value that is actually not a not a numeric value.

140
00:09:53,930 --> 00:09:54,630
Right.

141
00:09:54,690 --> 00:09:57,910
So in that case it's going to actually execute this Cheche plug.

142
00:09:58,350 --> 00:10:03,570
It's going to execute this check catch plug and then it's going to assign this number point zero.

143
00:10:03,600 --> 00:10:07,130
This number is zero point zero to this total salary.

144
00:10:07,290 --> 00:10:08,180
Right.

145
00:10:08,220 --> 00:10:13,580
So in that case in that specific case it's not going to actually crash.

146
00:10:13,620 --> 00:10:14,220
OK.

147
00:10:14,220 --> 00:10:18,150
We are catching this error here so hopefully that makes sense.

