I have an Android ListView that has a small (say 1-5 frames) stutters when it scrolls about every second or so. I understand that many Android phones have problems with the smoothness of the animation, but on my phone (Motorola A855 running Android 2.2) my own contact list scrolls pretty smoothly. Viewing a position in a contact list is more complicated than representing an item in my list:
<RelativeLayout> <TextView /> <TextView /> </RelativeLayout>
I just want to achieve smoothness as good as my native contact list. It seems that this should be possible without optimization in the native code, but maybe I'm wrong.
I tried several things: I simplified the presentation of the element even more, and I tried to create it programmatically instead of XML. I also tried to change the way we respond to events when an element clicks on this link:
http://groups.google.com/group/android-developers/browse_thread/thread/7dc261a6b382ea74?pli=1
None of this affects performance.
Is there anything I can do in my application to improve performance? I am looking to deploy this application on multiple phones, so changing the settings on the phone or rooting the device in my case is not an option. Here is the getView method from my adapter class:
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; }
Thanks in advance!
android android-listview smooth-scrolling
charleslparker
source share