Reputation: 671
I am aware that a recycler
adapter and listview
basically recycles
adapters that can fit a given screen giving the user the illusion
of multiple items, my main reason for this question is because I have an app that loads a great deal of images in a recycler
using Picasso
but I noticed Picasso is not doing the job as expected, my app uses roughly 10mb
on the emulator
and about 4mb
on real devices, this is really good for an app that displays images but I want to go further, I want to be recycling bitmaps myself in the method that is called when an adapter leaves the screen, that is, since views are recycled there has to be a method that removes data out of an adapter and refills it with new data to make that illusion
a reality, I looked at the recycler adapter documentation and I noted 2 methods the onDetachedFromRecyclerView
and onViewDetachedFromWindow
both of which cannot be overridden, anyone have an idea on how I can approach my problem?
Upvotes: 1
Views: 1257
Reputation: 671
solved it, I had to override onViewRecycled
and the previous 2 methods are overridenable except I did not know how to, I know do.
@Override
public void onViewRecycled(MyViewHolder holder) {
super.onViewRecycled(holder);
//destory anything here
}
Upvotes: 3