Source:
public View getView(int position, View convertView, ViewGroup parent) { View element = convertView; if(element == null){ LayoutInflater inflater = (LayoutInflater) this.mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); element = inflater.inflate(R.layout.song_item, null); } View userColor = (View) element.findViewById(R.id.user_color); TextView title = (TextView) element.findViewById(R.id.title); TextView artist = (TextView) element.findViewById(R.id.artist); TextView album = (TextView) element.findViewById(R.id.album); ImageButton addButton = (ImageButton) element.findViewById(R.id.btn_add_to_playlist); String macAddress = metadataList.get(position).getMacAddress(); User user = users.getUserByMACAddress(macAddress); if (user != null) { userColor.setBackgroundColor(user.getColor()); } else { Log.wtf(TAG, "User with mac address " + macAddress + " not found. Using default color."); userColor.setBackgroundColor(mContext.getResources().getColor(R.color.transparent)); } userColor.setMinimumHeight((int) mContext.getResources().getDimension(R.dimen.song_height)); title.setSingleLine(true); artist.setSingleLine(true); album.setSingleLine(true); addButton.setTag(position); addButton.setContentDescription(addButton.getContentDescription() + "_" + metadataList.get(position).getTitle()); title.setText(metadataList.get(position).getTitle()); artist.setText(metadataList.get(position).getArtist()); album.setText(metadataList.get(position).getAlbum()); artist.setMaxWidth(parent.getWidth()/2); final GestureDetectorCompat songGesture = new GestureDetectorCompat(mContext, new SongGestureListener(element)); element.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return songGesture.onTouchEvent(event); } }); return element; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View element = convertView; if(element == null){ LayoutInflater inflater = (LayoutInflater) this.mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); element = inflater.inflate(R.layout.song_item, null); } View userColor = (View) element.findViewById(R.id.user_color); TextView title = (TextView) element.findViewById(R.id.title); TextView album = (TextView) element.findViewById(R.id.album); TextView artist = (TextView) element.findViewById(R.id.artist); ImageButton addButton = (ImageButton) element.findViewById(R.id.btn_add_to_playlist); String macAddress = metadataList.get(position).getMacAddress(); User user = users.getUserByMACAddress(macAddress); if (user != null) { userColor.setBackgroundColor(user.getColor()); } else { Log.wtf(TAG, "User with mac address " + macAddress + " not found. Using default color."); userColor.setBackgroundColor(mContext.getResources().getColor(R.color.transparent)); } userColor.setMinimumHeight((int) mContext.getResources().getDimension(R.dimen.song_height)); title.setSingleLine(true); artist.setSingleLine(true); album.setSingleLine(true); addButton.setTag(position); addButton.setContentDescription(ContentDescriptionUtils .addToPlaylistAppendSongTitle(metadataList.get(position))); title.setText(metadataList.get(position).getTitle()); artist.setText(metadataList.get(position).getArtist()); album.setText(metadataList.get(position).getAlbum()); artist.setMaxWidth(parent.getWidth()/2); final GestureDetectorCompat songGesture = new GestureDetectorCompat(mContext, new SongGestureListener(element)); element.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return songGesture.onTouchEvent(event); } }); return element; }