Everyone in this theater early on we're going to go ahead and create and apply this.
OK.
And in this application we're going to actually use the expandable list view in our application.
So let me show you how this works.
As you can see here we have an application that actually uses an expandable list view.
And if we actually tickle the kindest support here as you can see here now about this group view this
sport is actually has a child.
OK.
And we can see that these are values that are inside of this support group view is actually are actually
the children of this sport.
OK.
And if I click on this computer as you can see we have this computer and we have these children of this
computer.
And as you can see this is the same story for the food here.
So this is called the group view.
OK.
And these are the children of this group view as you can see here.
And if you have car OK and we have these children and this child of this car and we have these TV and
we have these children of these TV.
OK.
So in this obligation between we can actually create an app like this we need to actually click on this
start in your Android studio project and then for the application name just type in here app 55 and
then click on next and he has two API 16 Android 4.1 Jelly Bean next launch activity next and then click
and finish.
And now let's actually select this hello or take you here and then press on delete key on your keyboard
and then double click on this address folder here lay out and then activity underline made that example.
So now it's actually the selectees of floating action button here.
And then press on delete key on your keyboard.
OK.
So let's actually to go back inside this content underline made that example and here of any to actually
design the user interface of our application.
Now let's actually try and expandable this view into this lay out here.
OK but first of all it's actually a linear layout vertical into this relatively out and put it at the
center of these relatively here and now let's actually go inside these containers for that as you can
see here.
As you can see we have these expandable at least.
OK.
Just select it and put it at the center of these linearly outwards the call.
OK.
And as you can see we have these expendible is you hear double click on it as you can see we have this
idea here.
OK.
So this is the idea of this expendible this view and just leave it as default expendible this view OK.
So let's actually go back inside the Smain activity that you will find here and now this actually did
it.
These lines of code that are related to the to the Options menu.
OK.
And here I select this block of code and then delete this.
OK as you can see this block of code is actually related to the fluting action button.
OK.
So we don't need it.
And now inside this class there's actually create an object of type expandable list view expand double
list view as you can see here you have this up close here expandable list view and actually give a name
to this object expand the broadest view and put a semicolon here.
So as you can see here we are just declaring this object here inside of this class and inside of these
uncreate.
I want to initialize this object.
So here I could just refer to the name of this object expandable list view assignment operator.
And here I need to cast this object on to an expandable view object.
So as you can see here find view by id r that Id dot expendible list view.
OK.
And then put a semicolon at the end of your statement.
So now let's actually create a Java class.
OK.
So that we can actually bind are expendable.
Few coats of it these are expendable Eastview OK.
So if you actually create another separate class our job would be more our work would be more cleaner.
OK.
And it is more professional to actually create a classes for every specific job that you want to actually
perform in your program.
So I just need to click on file.
Neal.
Okay.
And then dhaba class and here for the name of my class I can just type in expandable list view adapter.
OK.
So as you can see here are the job of the adapter is to actually buying the data of the view that we
have in our layouts.
OK.
So that's why we need to actually create an adapter.
OK.
And then click on OK.
So as you can see here we have these expandable this new adapter here.
OK.
So now we need to actually extend from the base are expandable list adapter class.
So as you can see here we have these basic expandable adapter and this glass expandable this adapter
is actually inheriting all of the features and behaviors that are inside of this base expandable adapter
class.
OK.
So let's actually open our web browser and see what is this based expandable adapter.
So as you can see here this is the android documentation and you can actually enter this.
You are ill in your web browser in order to be guided to this page.
And we have these are based expandable adapter.
And as you can see here this is actually an abstract class.
OK.
So objects can be created from this class.
OK.
And here you can see it says that base class for a expandable list adapter used to provide data and
views from some data to an expandable view.
OK.
So if you have an expandable is you here as you can see this is our least view and this class expandable
this adapter used to provide data.
Okay.
And views from some data are to an expandable list view.
OK.
Adapter's inheriting this class should verify that the base implementations of get combined child ID
and get combined group ID are correct in generating unique IDs from the group or student IDs.
OK.
And we can see some efforts that are inside of the space expandable it after class.
OK.
And we need to actually implement some of those methods.
OK.
And you can see we have these if it's here gets combined globality and we have this good group type
and other methods.
So now let's actually go to our Android studio and let's to go inside this expandability adapter class
here.
And as you can see it's now showing us an error.
So let's actually hover our mouse pointer here and it says class expendible this adapter must either
be declared abstract or implement abstract methods that are inside of these base expandable adapter.
So how can we know actually what are the methods what are the abstract benefits that we need to actually
implement inside of this class.
So here I can just right click inside of this class expendible this adapter and then click on generate
as you can see here and then click on implement Misfit's.
So as you can see here we need to actually implement all of these methods that are here.
OK.
As you can see if you have lots of efforts here and we need to actually implement all of these benefits
or in other words we need to actually overwrite these methods.
OK so here if I click on OK as you can see now the error is gone.
OK now I am actually overwriting them if the methods that I am actually inheriting from these abstract
class.
OK.
So this is really important but first of all it's actually putting some more lines of code here inside
of this class and then we're going to go ahead and implement these methods.
OK so now I'm pasting some lines of code here and then I'm going to explain to you what's going on here.
OK.
So as you can see here these are the lines of code that I actually paste that here first of all I actually
created an array of string values as you can see here.
This is actually a one dimensional array.
And the name of this area is group names.
So as you can see here in our emulator this is our application and these are the names of the group
will take groupings.
So as you can see here sport computer food court TV and here as you can see inside of this Arai I actually
assign these values sports computer food court TV and we have a two dimensional array for child names
as you can see here.
This is actually a two dimensional array.
And the name of these are Ariz child names.
And as you know our two dimensional art is actually an hour raise is actually a raise or an alley of
race.
OK.
Our two dimensional alley is actually an army of Ivory's.
OK.
So if you have an A here and we have some trees inside of these arii OK for example for the first grade
that is actually inside of this army we have boxing kickboxing judo football basketball.
And here we can see that if I click on this sport here you can see these values inside of this sport
here.
OK.
And as you can see if you have for the second grade that is actually inside of these child names two
dimensional array.
We have this computer laptop computer smartphone computer.
And if you click on this computer you can see these values.
And here you can see that we have another ice cream banana.
And as you can see this is for food and you have Mercedes-Benz and we have this card here and we have
these same same TV and LG TV.
And this is for these TV here.
Well Kate.