Hello there.
I'm coming on.
And welcome back.
Demand what you don't use in today's video when we're talking about recycling.
So what does all this I love you.
It is just like the last view.
But then why do we need it.
Well sometimes we need to leave huge amounts of data on loading all that useless in the memory results
in about application performance and might even make your application flash blown.
Here comes the recycling even the picture.
So what it does is it creates value items which are scored in the screen and destroys the items just
go out of the screen.
So what's happening here is the only limited small amount of new items which are visible on your screen
are only present in the memory.
That's why giving us more scroll on a better application performance.
So let's get started.
Let's create a new project
let's call a recycling tutorial
let's the next button guy.
We're going to keep on going on as the guest of theme y so that we can run our application on almost
100 percent of the devices running ongoing in the world.
Let's add the next button.
Let's start with an empty activity.
Let's go home.
First off building is made up.
So let's send the finished button
well understood who's was building a project.
So let's wait.
Well the projects built on it's ready to go.
So let's get started long before we get started to use it as I give you two other defendants in the
green.
So let's do that.
So great credits application Garrido and other dependency here so implementation com Android support
I love you re seven Golden and those emotions which is yet to win 6 1 2 1 1 0.
So let's sing the grid allow
Well the grid as well and we were good to go so let's close this coming to the left file so let's get
rid of this constraint out get let's use the little allows you let's fill the orientation say where
go.
Let's get rid of this text you when you've been cyclone move you sewer recycler you were much better
and I'd much Behrendt get it I did it with an I.D. So let's say so.
Coming to the functionality right now we need an instance of the cycle view so let's create one.
So private.
Here's a clue.
Let's call and say you let's initialize it.
So as I music will do fine.
But idea that I.T. on recycling.
OK.
So we've got an instance of others idea of you.
So recycling requires another item which is allowed amount.
So we've got several managers.
So for instance you've got a leaner out manager using again defined less to be in a linear fashion which
could either be horizontal schooling or vertical schooling.
And we've got a great loud manager so let's use a leaner manager view.
So Mineola manager Let's call it level managers will do you know a manager.
That's more like the context.
So this again lets us send a loud manager not recyclable.
So it's like you said loud manager and let's.
That's our object to.
So there you go.
Now all we need is an adapter.
So let's create one.
So project application Java or directory right click new Java class.
So let's call it customer uptime
that's a little bit about
let's close this.
So there is clearly a base on the bottom.
So what's the beholder.
Miller describes an item you unlimited data about its position in the recycling.
So let's create a we will last year.
So public we will do.
And this needs to be a subclass of cycling.
We will do.
So let's extend that extends the cyclone to dot.
We will do okay.
And this requires a construct.
So let's avoid that.
So public we will do it needs view as a barometer.
So that's that.
Let's then put the glass on simple view.
Well constructor is ready.
So let's underscore some adopted glass.
Even this needs to be a subclass all recyclable adapters.
So let's do that.
So extends recycling that adapter.
Let's pass the new order so a custom adapter dot we hold.
Well it requires some implementation of some functions.
So let's implement those.
So on create we Holder on mine hold and get a dot com okay.
So create we hold it here.
We include all out the loop.
So let's do that.
So view music will do now inflator from
okay.
So let's define a constructor because we need the data to be populated here along with the context so
public custom adapter context on an average list.
So let's define this out of this of strings let's call it either list let's define some member variables
or private context
and again try with our other list which is of type String let's call it I witnessed let's send the values
here.
So this dot context is a go do context.
Similarly for our list based on our list as a go do list.
Well our constructors ready so we can use context here.
So context inflate.
So we need now to.
So let's define allow for the view items.
So resources.
Now let's create another allows you let's call it list item now.
Also they'll get done.
Let's close this systematic small again.
Let's get rid of this constraint low.
Let's use a linear Little Chip let's do the orientation a vertical let's change the height to rub content
that we're talking about a list item.
OK so let's define it X with you so much parent.
I drop content that's for an idea so let's call it Android version.
OK.
Let's check the preview.
Let's bring it to.
OK.
So we got to go.
Let's just copy this.
So going back to an upper class so let's use a loud cheers So order.
Note dot list item left.
Let's pass the group so which is parent.
We don't want to attach or new in the group.
So false let's create a v Holder instance now.
So we hold the let's call it v Holder is go do we holder.
And this was about a meter which is use looks bus or you and this entire function on create.
There are of your will.
So let's return our newly created to hold of you.
A function is ready.
So this another function on buying you older you'll be buying a data and allow items.
So we do that shortly.
So.
So this function get item count it returns the number of list items.
So let's implement that.
So if our list is not equal to no analyst Don size is greater than zero.
So we're just saying if our analyst is not null or if it's not empty.
If that's the case then we'll return the size of the list because that would be the number of list items.
Else we'll just return zero.
OK.
So coming to our we will we know so does class say holds an instance to a view or two out loud.
So here we get to friends or views.
So let's do that.
Well now we've got an stands of our view items and we've got a list to be populated.
So moving on to the on my new world.
So we're just going to bind our values to the items.
So let's do that.
So Holder don't want your name said text.
I'm a realist but get dimmer position that's all.
So this will take the strain from the analyst to only.
OK.
So adapters it is so moving back to a mean activity.
OK let's create an instance of this adapter here.
So a custom adapter let's call it custom adopter new custom adapter.
It requires two parameters a context and a list of strings.
So let's create one two private barrels of string get released.
Okay let's create an order list inside
our list is equal to new our list.
Let's create a string
s let's call it
cupcake.
Let's do that.
Let's dot an s Let's do this a couple of times to create a list and let's just do this.
EARNEST Well our list is ready so let's just pass the tube so we get our list.
And let's just say this adapter to our recyclable suicide Globe you set it up to custom adapter.
Well everything's ready.
Let's build our application and have a look
well obligations built.
So let's have a look.
Get it's open wiser as you can see our applications running and we can see a list of cupcake but it's
not scrolling because the list items aren't enough.
Let's provide some padding and margins just to make things a little more clean.
So let's provide a batting here.
Say five DP and let's provide a margin.
You say five DP So that would give us a total of 10 DP.
So let's run our application again.
Well applications running so let's have a look.
Well now as you can see it's scrolling on.
That's all for cyclone folks.
If you have any doubts any queries feel free to comment on we'll go through it.
And if you need to code the link to github is already in your description.
Check it out by.