/ Published in: Java
The right way (According to Google I/O-10) to use getView with the convertView-param within a custom adapter class.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if (convertView == null) { convertView = mInflater.inflate(R.layout.item, parent, false); } ((TextView) convertView.findViewById(R.id.text)).setText(DATA[position]); ((ImageView) convertView.findViewById(R.id.icon)).setImageBitmap( (position & 1) == 1 ? mIcon1 : mIcon2); return convertView; }
URL: http://www.google.com/intl/sv-SE/events/io/2010/sessions/world-of-listview-android.html