title: Gallery ImageAdapter convertView is always null
body: <p>I am using a Gallery with an ImageAdapter to load it with ImageViews that pull images out of my resources. My problem is that the convertView that gets passed to the getView() method in my adapter is always null. This means that a new ImageView is created each and every time getView() is called. This leads to horrible preformance because the GC is constantly running to wipe away all of these created and no longer used ImageView's. </p>
  
  <p>This is apparently a known bug: <a href="http://code.google.com/p/android/issues/detail?id=3376">Gallery's view cache is broken; never converts views.</a>.</p>
  
  <p>My two preferred solutions are either 1. handle a cache of views in the adapter itself and take care of all the logic required to re-use them properly.
  or 2. include a my own copy of the Gallery widget and try to fix it so it properly returns recycled views.</p>
  
  <p>I've started implementing option one but am quickly realizing I don't exactly know how to make all of the logic behind that operation. I am begining to think that option two might be easier. </p>
  
  <p>I've found the code for the Gallery widget here: <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.1_r2/android/widget/Gallery.java">http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.1_r2/android/widget/Gallery.java</a></p>
  
  <p>I don't fully understand it, but I can see that it is calling </p>
  
  <pre><code>child = mAdapter.getView(position, null, this);
  </code></pre>
  
  <p>on line 745. My (shot in the dark) guess that this is the root of the problem.</p>
  
  <p>Does anyone have experience with this bug. Or can anyone point me in the right direction for figuring out how the recycler situation works so that I can tweak this widget to work correctly? Or even suggest some alternate option that I may be overlooking.</p>
  
  <p><strong>EDIT:</strong> The best solution that I ever found was an implementation called EcoGallery. The only place I can find reference to it <a href="http://www.scribd.com/doc/87582641/Eco-Gallery-Android-Gallery-Widget-With-Recycling">online anymore is here</a>. To get it working you have to put each chunk from there in the correct place within your project.</p>