OK.
So button ok.
PTEN second activity.
OK.
Assignment operator and then here I can actually cast this object to a button object.
So button find view by ID or that ID that PTEN second activity.
OK.
So now let me explain some concepts here.
As you can see here this is our main activity and this activity actually extends this act of compact
activity.
OK.
So this main activity actually inherits all of the features and behaviors that are in sight of this
composite activity.
So if we just hold the common key and then press on this class here and if you are using a Windows machine
you need to hold the control key and then press on.
These are compact activity here.
OK.
So as you can see here this is our app computer activity and this computer activity as you can see there
are lots of misfits here inside of this class and here.
This class actually inherits all of the features and behaviors that are inside of this fragment activity.
So this class extends this fragmented activity and there is an ease our relationship between these two
classes and computer activity is up fragment activity.
OK.
And if I hold the command key and then press on this a fragment activity as you can see this is our
fragment activity and this class extends the base fragment activity honeycombs.
So there is an is a relationship between these two classes or cases of fragment activity and this base
fragment activity honeycomb.
OK.
So if it actually holds the command key and then present this class here the base fragment activity
honeycomb as you can see it says this based fragment activity actually extends base fragment activity
do not.
OK.
So this class actually is actually up base like a base fragment activity or not.
So there is an is a relationship between these two classes.
So if I hold the command key and then press on this class as you can see here it says this base fragment
activity not actually extends activity.
So there is an is a relationship between these two classes.
OK.
And this class inherits all of the features and behaviors that are inside of this activity class.
So if I hold the command key and then press on this activity class as you can see it says this activity
class actually extends this context from lapper.
OK so now as you can see here inside of this main activity if I just say that main activity extends
and combat activity you can see that this class is going to actually inherit lots of methods from all
of these classes are complete activity fragment activity based flagmen activity honeycomb based fragment
activity not and this activity class.
Ok so are these really important because in order to create an activity in our project.
OK.
In order to create an activity in our project in order to show the user some of outputs on the screen
we need to actually create an activity.
And here we need to actually extend from this app compact activity.
OK.
And as you can see this is our uncreate Smurfette and we are actually inheriting the Smurfette from
base and compare activity.
OK.
Uncreate.
And as you can see here it says at sign over.
Right.
So we are overwriting this memory.
OK.
And inside of this Mefford here it says super.
So super refers to the superclass.
OK superb.
That uncreate.
So here it's going actually are called the uncreate Meffert of the superclass here as you can see.
Initialize the uncreate effect of the superclass.
OK.
Superdad and create Mefford and inside of the Prentice's as you can see it says saved instance state.
OK this is our bundle OK.
This is actually this object is actually of type A bundle.
OK.
And you don't need to know about this Bondel class.
OK but for now you just know that this is our bundle and this is an object of this one.
And here we are.
This is actually a parameter.
And here we are passing these parameters through the uncreate method of the superclass.
So if I hold the command key and go inside of this app compact activity here as you can see there is
actually an uncreate Mfat here again.
So this class actually is overwriting this method.
So and here as you can see it says uncreate And yet as you can see it has an ad site nullable Bondel
save instant state.
So at this moment as she exits an argument of type bundle and it is actually the nullable.
OK.
And here you can see these implementation's inside of this method.
OK.
But these are not are important and you don't need to know about these implementations but inside of
this main activity that job I find here we need to actually call the uncreate Meffert of the superclass.
We need to actually initialize the uncreate of the super of the superclass before we can actually call
the set content view here.
OK so it's content view are that lay out that activity underline main.
OK.
So some of it is going to actually call this set content view here as you can see here.
And this is a method that you actually inherit from the activity class.
OK.
And this is going to actually show the user activity main.
So this is our activity in that example.
Okay.
And then here as you can see it actually created an object from this toolbar class.
Ok toolbar.
And here it is actually initializing this object find view by ID or that Id dot toolbar set support
action bar tool bar.
So it's going to actually create a toolbar in our application.
OK so now let's let me actually comment out these two lines of code here.
So here let's actually run our project and see what happens.
So as you can see here our application is running on this emulator here.
And as you can see there is no toolbar here.
OK.
And if I go back and say this main activity double file here again and if I uncomment these two lines
of code here.
OK.
As you can see here now as soon as an error.
OK.
Because of we didn't actually import the toolbar class into this class here.
So here I just need to delete this toolbar here and then type it again here.
OK toolbar.
OK so now the toolbar class is actually automatically imported into this class here.
OK.
So let's actually run our project again and see what happens.
So as you can see here our application is running again here on the simulator and you can see this toolbar
here OK at 50.
So hopefully that makes sense.
And now let's actually go back and say this main activity that our fight here again and here I want
to actually make the Spartan this PTEN second activity button a listener to the clicks that the user
make on the button inside of this screen here.
OK.
So as you can see here I made a mistake here.
And let's to go back and say this content underline that example.
And here I need to click on this a clear cashier and here as you can see for the text of this button
I just need to delete this letter T here and then press enter key on your keyboard.
OK.
So let's go back inside this our main activity that will fight here let's actually close this.
I've compiled activity out of a file.
Now I want to make the spot in listeners to the clicks that they use and make on the spot.
OK.
So here I just need to type in between such an activity that sits on click listener.
OK.
So unclick listener is actually an interface in Java.
OK so here inside Apprentice's I need to actually specify the activity that this listener is belong
to.
OK.
So first of all let me actually hear implement did unclick listener interface.
So here I just need to implement implement view.
That's unclick listener.
So as you can see here this is actually an interface.
Ok if you look at unclick and it is an interface in Java.
And as you can see it is showing us an error and it says class main activity must either be declared
abstract or implement implement abstract Smurfette unclick.
As you can see here in unclick listener.
OK.
So this is actually an interface.
And as you know are about interfaces in Java that are abstract methods in interfaces and in an interface.
And we need to actually add every class that implements that interface need to actually implement the
inherited method from that interface.
Ok so here if we need to actually implement that inherited method that is inside of this unclick listener
interface.
So after this uncreate method let's actually type in here and click OK.
So as you can see here this is the inherited Meffert from this article it's an interface.
And if I press Enter key on my keyboard.
Now you can see the Smurfette here.
OK.
Sign over right public Voyt and click it.
OK.
And this is if it actually exits an argument of type view and the name of this argument is the OK we
can actually change the name of this argument to another value for example view.
OK.
And every court that we actually put in here is going to happen after we actually click on this.
Let's go to say second activity button here.
OK.
So now inside Apprentice's I need to specify the activity the class that this listener actually belongs
to.
OK.
So here we are making this between second activity a listener to the clicks that the user makes.
OK on this button.
OK.
So here I need to specify the activity so I can just type in this.
So this refers to this class.
OK.