Hi everyone.
So now it's time to create another class inside our project.
So let me actually just show you the Android view here.
If you don't have the outward view opened here you just need to add a puppy and you just click on real
tool windows and then click on project and then you can see the Android view.
So inside this app for that we have this job folder inside this double folder we have this package right.
So just click on this package that actually holds these main activity class likely.
Right click on this by each year new and current job class for the name of the class here.
Just typing here.
Colorful colorful here you can see that the type is class.
Just click on OK.
Right here we have the colorful class.
So now it's time to actually implement this class.
It's time to add some implementations inside this class.
So just double click on this colorful dot dot happy in order to make this area wider.
Now I can't say first of all we mean it will have some instance variables.
So the first is that an instance variable is going to be private the data type of this instance variable
is going to be a bitmap and the name of this valley is going to be bitmapped semi-colon.
The second instance valuable is again private float and the name is going to be a red color value semi-colon
private float and the name of this instance variable is going to be green color value semi-colon private
float and the name of this instance variable is going to be a blue color value blue color value semi-colon.
So these are our instance variables.
Now it's time to create a constructor for this colorful class.
So here I can say publish the access modifier of my constructor is public.
So remember I told you that the name of your constructor must be the same as the name of your class.
So the name of the class is colorful bright colorful and that I put a pair of prentices in order to
specify that this constructor is going to accept some after the arguments.
So if we need to specify the prime intercede for the first trimester is going to be off the bitmap bitmap.
And here I can say bitmapped comma.
And here I need to specify the second trimester which is going to be off that floats and the name is
going to be again read value Rillette value comma floats green value green value.
Come on floats below value blue value.
Let's open and close this constructed by using these curly braces and opening curly brace followed by
closing calibrates.
Let's go inside the body of this constructor and now it's time to initialize our instance variables
the first instance variable is actually the bitmap.
But you can see that the name of my instance variable.
And then even the name of my actually parameter here is the same is exactly the same.
So in this case you must put this dot bitmap in order to refer to this instance variable.
Remember I told you this refers to an instance of type color for class.
So when I say this that be bitmap I am referring to an instance variable of this class.
So it is going to actually refer to this bitmapped instance value an assignment operator and I can refer
to this privater bitmap semicolon.
Right.
If you don't want to use this here this syntax actually I can comment out this line of code and instead
of bitmapped I can say for example new bitmap new beats map right.
So in this case we do not have to put the keyboard this year in order to refer to this instance variable
because the name of my instance variable is actually different from this new bitmap parameter name from
the Internet.
So here I can just easily say bitmap assignment operator new bitmap byte semicolon.
So that's possible.
I just wanted to actually let you know about this syntaxes because it is very important to know about
this syntax in Java because later you want to actually look at other projects.
So you may be actually look at some codes that are similar to this one here.
Right.
So now let's initialize our red color values so here I have a red color value.
Assignment operator read value semicolon.
So instead of actually allowing this constructor to access my instance variables directly I can actually
use this setter.
So I haven't still created a certain method for this instance variables.
Yet in this class.
So I want to just type them in here either I'm going to create this little later.
So here I can just see a set of red colored values set red color value and I put a pair of prentices.
And here I can pass the right value to dismiss that semicolon or for example I can say set green color
value green
color value.
And I put up at Apprentice's and here I can see green value semi-hollow.
And here I can say said blue color value.
And here I can say who value same color.
Right.
So that's it.
Now after it's constructive it's time to actually create some setter's so you can see it is so term
remove it see it right.
But we haven't still created these sitters.
The first move it is going to be this one set with color value.
So let's see how we can do that.
So public void and the name of this method is going to be set a red color value right.
I put a pair of practices and I need to specify the argument which is going to be off that float.
And here I can say for example read value right.
And then I just open and close dismiss it by using this curly braces.
So here I'm going to create an if statement so if now I'm going to refer to this prime turning red value
is actually greater than or equal to zero.
And rate value is less than or equal to number one.
Right.
Because here we are specifying a value for the color.
We must actually choose a value that is between 0 and 1.
Right.
So that value is actually just a kind of a formula if you want to specify if you want to create a colorful
application if you want to for example make your image Acuff colorful.
Right.
So the value should be between 0 and 1.
Now inside this if statement I can't say if this condition is actually true I can't say I have referred
to this instance valuable red colored values or red color value assignment operator red value semicolon
that that's this is or settle for the red color.
So let's create another set at my fifth year public Voyt and the name of this is going to be set green
color value right.
A pair of Apprentice's floats.
So here the name of this parameter is going to be green value when value add an open and close the set
by using these curly braces and opening curly brace followed by a closing calibrates.
So let's create an if statement.
Again the same scenario here right.
I can't say if green value is actually greater than or equal to zero.
And green value is less than or equal to number one.
Then only in that case we want to actually assign a value to our clean cut value instance value.
So green color value assignment operator green value SEMI-CHORUS that's it.
Now let's actually create a set here for this method.
This blue colored value is valuable.
So before the end he can elaborate of this class I can say Puplick void.
So the name of this month the name of this effort is going to be set to blue color value and then put
up in our practices again that heat up of this apartment and it's going to be flawed.
And the name of this parameter is going to be blue value blue value.
And I just need to open and close this center by using these curly braces.
So if you value I am referring to this parameter turning right is actually greater than or equal to
zero and value is less than or equal to number one then only in that case.
I want to initialize my blue collar about you instance variable.
So here I just need to assign this blue value to this particular value instance value of a semi-colon.
That's it.
So these are our setters.
Now it's time to create get here for our instance variables here.
So I am going to create a getter for the red color value green color value and the blue color value.
So before adding calibers of this class I'm going to say publish a float.
I'm here in the name of this method is going to be get light colored value and then put a pair of parenthesis.
This method is not going to accept any arguments any parameter.
So just open and close this method by using the curly braces and instead just return the value of the
red colored value instance variable right.
So again public float and again get a green colored value open and closed is perfect but using curly
braces really turn green color value semi-colon.
And finally let's create a for our blue colored value instance variables so public float gets blue color
value and just open and close this method by using these curly braces.
Return blue color value semicolon.
So these are all getters for instance variables.
Now it's time to create a method in order to allow an object an instance of this class to colorize the
image that the user has taken by using the camera of the device.
So I'm going to create an effort here.