Skip to content

Instantly share code, notes, and snippets.

@rduplain
Created December 16, 2011 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rduplain/1487917 to your computer and use it in GitHub Desktop.
Save rduplain/1487917 to your computer and use it in GitHub Desktop.
Android: view holder without a ViewHolder class, when only one view to hold.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = activity.getLayoutInflater().inflate(layoutId, null);
convertView.setTag(convertView.findViewById(textViewId));
}
TextView textView = (TextView) convertView.getTag();
textView.setText(items.get(position).getTitle());
return convertView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment