private static final int ITEM_VIEW_TYPE_MUSIC = 1;
/**
- * Number of views (ImageView, TextView, header)
+ * Number of views (List Items, header)
*/
- private static final int VIEW_TYPE_COUNT = 3;
+ private static final int VIEW_TYPE_COUNT = 2;
/**
* LayoutInflater
private final LayoutInflater mInflater;
/**
- * Fake header
+ * Fake header Id
*/
- private final View mHeader;
+ private final int mHeaderId;
/**
* The resource Id of the layout to inflate
// Used to create the custom layout
mInflater = LayoutInflater.from(activity);
// Cache the header
- mHeader = mInflater.inflate(headerId, null);
+ mHeaderId = headerId;
// Get the layout Id
mLayoutId = layoutId;
// Know what to put in line two
// Return a faux header at position 0
if (position == 0) {
- return mHeader;
+ if (convertView == null) {
+ convertView = LayoutInflater.from(getContext()).inflate(mHeaderId, parent, false);
+ }
+
+ return convertView;
}
// Recycle MusicHolder's items