Recycling views in a listview, worth it?

A couple of reasons to recycle views:

  • Object creation is relatively expensive. Every additional object that is created needs to be dealt with by the garbage collection system, and at least temporarily increases your memory footprint
  • This is more important for more complex views, but inflating and laying out the view objects can be expensive. Most often, you are only making minor changes to the view in getView that won’t affect the layout (e.g, setting text) so you might be able to avoid the layout overhead.
  • Remember that Android is designed to be run in a resource constrained environment.
  • Finally, its already done for you, and it certianly doesn’t hurt anything, so why not use it?

Leave a Comment