title: Improving Scroll Smoothness in an Android ListView
body: <p>I have a an Android <code>ListView</code> that has small (say, 1-5 frame) stutters as it is scrolling, about every second or so.  I realize that many Android phones have these problems with animation smoothness, however, on my phone (Motorola A855 running Android 2.2), the native contact list scrolls quite smoothly.  The item view in the contact list is more complex than the item view in my list, which is:</p>
  
  <pre><code>&lt;RelativeLayout&gt;
      &lt;TextView /&gt;
      &lt;TextView /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I only want to achieve smoothness as good as the native contact list.  It seems like this should be possible without optimizing in native code, but perhaps I'm wrong about that.</p>
  
  <p>I have tried a few things:  I simplified the item view even further, and I tried instantiating it programmatically instead of in XML.  I also tried changing the way I react to item click events, as per this link:</p>
  
  <p><a href="http://groups.google.com/group/android-developers/browse_thread/thread/7dc261a6b382ea74?pli=1" rel="nofollow">http://groups.google.com/group/android-developers/browse_thread/thread/7dc261a6b382ea74?pli=1</a></p>
  
  <p>None of these things seem to have any effect on performance.</p>
  
  <p>Is there anything I can do in my app to improve performance?  I'm looking to deploy this app to a number of phones, so changing settings on the phone or rooting the device is not an option in my case.  Here is the getView method from my adapter class:</p>
  
  <pre><code>    public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater flater = (LayoutInflater)context.getSystemService(ListActivity.LAYOUT_INFLATER_SERVICE);
          layout = flater.inflate(R.layout.song_view, parent, false);
          TextView first = (TextView)layout.findViewById(R.id.firstLine);
          TextView second = (TextView)layout.findViewById(R.id.secondLine);
  
          Thing t = array.get(position);
          first.setText(t.title);
          second.setText(t.name);
          return layout;
      }
  </code></pre>
  
  <p>Thanks in advance!</p>