So as you can see here these are the lines of code that I pasted here.
So now let's run our project but before that we need to actually comment out this line of code here
and now we can actually run our project.
So as you can see here our application is running on this emulator here and if we actually want to.
Let me add to be selective edits here and now I can actually assign a numeric value here so that's value
is going to be divided by 100 that I actually am against it.
I put this line of code here in order to divide that value by 100.
As soon as I assign that value into the edit text.
So here as you can see we have this value for example 500 is now $5 right.
So $5 and here $5 is actually the value of the spill amount and that value is going to be assigned to
the bill amount.
So this is that value right.
So hopefully that makes sense.
And now if the user actually enters a non-numeric value on that as it takes here we can actually catch
that exception.
OK.
So if the user enters on a non-numeric value in that inside that edit takes here it's going to actually
throw this number form an exception here.
So we actually put this catch block here in order to catch that exception.
And then the Apple application is not going to crash.
So in light 93 I when I truly said the text of this text the bill amount to an empty value as you can
see here and here you are actually assigning the value zero point zero to our bill amount.
OK.
So this block of code here is going to it is going to be executed if our text is actually empty or if
the user actually enters a non-numerical value inside that Eadie text.
So now let's actually uncomment this line of code here and here I need to actually create a handler
46 percent as you can see here.
Tepes part changelessness right.
So here after the end in Kerley place of this table takes the water handler here as you can see it to
actually create a handler for that Sebald percent.
So now I'm going to paste in some lines of code here and then I'm going to explain to you what's going
on here.
So let's actually write this handler by hand here.
So just type in here Plevna its final and here just type in search bar dot on See Spot change listener.
And now you need to specify the name of this handler.
So as you can see here via specified that name here keep C.P.R. change the center of just copy this
value here and then just put this value here and put an assignment operator here.
You on Six-Party change list and also as you can see here we have this option here.
Just select this option and then present in Turkey on your keyboard.
And now as you can see here the ID actually put these lines of code here automatically for us.
So here as you can see we have an error.
So at the end actually the after the ending curly brace of this handler of these it's Tepes each bar
change to the Senate you need to actually put a semicolon.
Now as you can see we have some efforts here.
The first one is unprogressive changed.
The second one is on start tracking touch and the first one is unstop tracking touch.
Right.
We need to use the Smurfette on progress changed.
OK.
So let's actually choose this.
And let's go inside the curly braces of this method.
And now I'm going to pasting some lines of code here inside this on progress change method and then
I'm going to explain to you what's going on here.
So here as you can see this is the line of code that I pasted here.
And are you referring to the name of this 3 percent variable.
So let's look at our class here.
As you can see I actually created this 3 percent variable which is actually type double here in line
21 and I assigned these values 0.25 to this value.
But for the first value right.
As you can see here I initialized this valuable by disvalue.
And now let's go back to our method here again.
And here you refer to the name of this progress here.
As you can see so many use for example 6 on that CPR.
So let's open our emulator here.
When we use them for example 6 on this six but we can actually get that integer value.
OK.
In the previous section of this course I talked about this part and how you can actually get that integer
value by using this argument and that he had because I want to actually convert that value to a person's
value.
I actually divided that value by 100 here.
Right.
So progress divided by one hundred point zero.
So now it's actually assigned that the result of this operation is the person here and now as you can
see we have two other MFX which we don't use them but we need to we need to override them here.
So now as you can see here we have these actually these handlers.
And here we need to create another method and then I'll talk about that Nefert here.
So first let me actually paste this method here and then I'm going to explain to you what's going on
here.
So as you can see here these are the lines of code that I pasted here.
So the access modifier of my method is actually private the return type of My method is void and the
name of my method is actually the calculate type and decide if it actually accepts no arguments.
So now let's actually to go inside the body of this method and let's see what's going on here.
First of all in line one hundred and fifty I actually referred to the name of this takes.
You object to 63 percent.
So let's go inside our class.
Main activity and here as you can see if we have this object we actually declare this object here to
60 percent.
And this is of type takes you right.
So here you can see inside is uncreate me they're actually initialized.
This takes 30 percent.
And if you want to show you that in a emulator.
So here it is our emulator and here is this 80 percent right.
So now inside these calculated Meffert I am actually setting the text of this 80 percent.
So to 60 percent that said text present format value.
So here are you referred to the name of this object that I actually created inside this main activity
class.
So as you can see here in say this main activity class I created this object per cent format's value
which is a type number format.
And here as you can see I initialized this number format here as you can see this number for my object
by typing number format.
I've referred to the name of this class number format.
And I actually called this strategem if it gets percent instance so this dispersant instance is going
to ask you to return an instance of type number format and then it's going to actually return this present
instance and that instance is going to be assigned to dispersant format's value.
So now let's go inside this calculated method here.
And now here as you can see I referred to the name of this person's format's value data format.
So I actually called this method on this object person format's value.
And then I passed this t percent.
So as you can see here we actually declared this this person here this person inside this may mean activity
class.
I actually created this 80 percent here and I assign this value 0.25 as an initial value to this valuable
person.
Right.
And then here as you can see inside this inside this on progress changed Smurfette as you can see I
actually assigned another value to this 80 percent variable progress.
So here I referred to the name of this progress argument divided by 100.
OK.
So for example when you use that are two to six on this sick bar here.
It's going to actually give us an integer value and then it's going to divide that value by 100.
As you can see here and then we can have actually a pair sent by the right because I want to convert
that value to a person's value.
So we need to divide that value to a 100 and then I assign that value to these two percent.
OK.
So if any use changes the value of the sick part.
Now I actually assign that value to wristy percent.
So this person now holds that value right.
So here inside our calculated method we can actually use that value 80 percent in order to set the text
of this to 60 percent.
So the excessive 80 percent that's it takes per cent format's value that format.
So this Meffert format is going to actually give us the specific format of that specific actually for
example Chaddock their percent that is actually regarded to our specific locale.
Okay.
So for example when the user is actually in a country in the U.S. or in Europe it can actually give
us a specific character that is actually a look at that specific to those locales.
OK.
But here in the U.S. this is this person's character.
So we use this up person character as you can see here.
So person for value that format type person.
Right.
And now as you can see here this remember that this formats MFL is going to return a string value.
So we can assign value here this person here into this into the practices of this text.
So it takes some effort and in line 152.
I actually created a variable of type double and the name of this value is actually the tip value.
OK so now I want to actually get the tip value and assign that value here.
So double tip value assignment operator.
And then I referred to the name of this bill amount variable that I created inside this main activity
class.
So inside this main main activity class we have this bill outwardly about right and I assigned this
value zero point it all to this amount of valuable.
So here as you can see inside these antics the changed Mefford that is actually related to this interface
takes whatever we can see that here I am actually assigning another value to the spill amount double
that part double is that was thrilling.
So for example if the user assigns a value into these edits here for example 1000.
So here this is the value of this amount as you can see here.
And then here it's going actually after we assign that value into it it takes it's going to actually
add that value to this takes the bid amount to CTX the bill amount that takes currency from value that
formats bill amount.
So now the value of this bill amount is the value that we actually assign here divided by 100.
So now that is actually put for example number two.
Soon as we can see here as soon as I assign the value numbers to interest it takes here it's going to
divide that number two by 100.
So that's what you can see the value here zero point zero to right this value was two and then it is
actually a divided by one hundred.
And now it is zero point zero two and then it's going to actually put that value into these peaks the
amount here.
Right.
Currency format value that format amount.
So now this bill amount has this value for example.
Now can I should I want to assign up for example the value of 200.
So I need to put the right value here.
For example we have two hundred dollars and now the value of this bill amount is actually 200 right.
So here inside this calculator tip F-ed.
When I created this variable which is of type double type value assignment operator bill amount.
So now for example the value of this bid amount is two hundred.
And then it's going to actually multiply these 200 by this 2 percent.
So this person actually holds the value of this search bar here.
OK.
So for example the user wants to pay 40 percent of the actually the meals that they actually ate.
So here we can actually put that value here.
And then you can actually use that value here to present.
So now let's actually run our project here at this point because I want to show you an important point
so it's going to actually multiply the value of this spill amount which is now two hundred by disvalue
80 percent.
For example 80 percent and the value of the 80 person is for example of 25 percent and then it's going
to assign that value to the steep value.
OK.
And that value is going to be the tip value that the user should pay in line.
One hundred and fifty.
We actually created another variable in order to calculate the total value that the user should pay.
So double total value assignment operator.
And then here you referred to the name of this bill amount.
For example 200 plus tip value.
And this is the total value that the user should pay.
And here in line one hundred and fifty five I'll refer to the name of the state's beauty tip that said
text.
So here I'll refer to the name of this place with you is to keep the state's currency format value that
format type value.
OK currency formats value that format is going to actually return a specific format of data.
For example value type value.
According to that specific locale that is actually that is actually set up in that in the user's device.
OK.
So now it's going to return that value.
And then it's going to assign that value here as this the tip.
So these are steep.
And here we have these TXI the total amount.
And here as you can see for this total we have this takes the total amount that takes currency format
value that format total value.
So he had referred to the name of the value of it.
So now we should actually call this method can actually teep after first we need to call this Meffert
inside this unprogressive change method.
So here I just need to type in calculator tip and we need to also call this method inside this on text
change method.
So here after this try catch block here I can actually call that method track too late.
So now let's run our project and see what happens.