The ListView
use a system that initialize only the row(view) that are visible to the user. When a row in not visible anymore it doesn't get destroyed, but it is used to inflate the layout of the next view that will be visible. With this system you have to save in memory only for the object that are visible, even if there is 1000 of item in your list.
Here you can find a more accurate description of the recycle system
I think you should also take a look at this video. It's a lesson on ListView
from Google I/O. I find out it is very useful to understand how ListView
works .
In your case, if you cannot use ListView
, i think you should implements manually this system. This is pretty hard so the best advice i can give you is to try to create a custom ListView
that fit your needs and use it.
PS:The method recycle()
is a bit different, it is used to delete any reference to the Bitmap
on which you are using the method. This way, the next time the GC run, it will be able to delete from memory the Bitmap