@@ -0,0 +1,2924 @@
+package de.michiruf.android.viewholder;%0D%0A%0D%0Aimport android.content.Context;%0D%0Aimport android.util.Log;%0D%0Aimport android.view.LayoutInflater;%0D%0Aimport android.view.View;%0D%0Aimport android.view.ViewGroup;%0D%0Aimport android.widget.ArrayAdapter;%0D%0A%0D%0A/**%0D%0A * @author Michael Ruf%0D%0A * @since 2015-08-08%0D%0A */%0D%0Apublic abstract class HolderDropDownAdapter%3CItemType%3E extends ArrayAdapter%3CItemType%3E %7B%0D%0A%0D%0A    private static final String TAG = %22HolderDropDownAdapter%22;%0D%0A%0D%0A    private int itemLayoutRes;%0D%0A    private int dropDownItemLayoutRes;%0D%0A%0D%0A    public HolderDropDownAdapter(Context context, int itemLayoutRes, int dropDownItemLayoutRes) %7B%0D%0A        super(context, 0);%0D%0A        this.itemLayoutRes = itemLayoutRes;%0D%0A        this.dropDownItemLayoutRes = dropDownItemLayoutRes;%0D%0A    %7D%0D%0A%0D%0A    @SuppressWarnings(%22unchecked%22)%0D%0A    @Override%0D%0A    public View getView(int position, View convertView, ViewGroup parent) %7B%0D%0A        ViewHolder%3CItemType%3E holder = null;%0D%0A%0D%0A        if (convertView != null && convertView.getTag() instanceof ViewHolder) %7B%0D%0A            try %7B%0D%0A                holder = (ViewHolder%3CItemType%3E) convertView.getTag();%0D%0A            %7D catch (ClassCastException e) %7B%0D%0A                Log.e(TAG, Log.getStackTraceString(e));%0D%0A            %7D%0D%0A        %7D%0D%0A%0D%0A        if (holder == null) %7B%0D%0A            convertView = LayoutInflater.from(getContext())%0D%0A                    .inflate(getItemLayoutRes(position), parent, false);%0D%0A            holder = constructHolder(convertView);%0D%0A        %7D%0D%0A%0D%0A        holder.apply(getItem(position), position);%0D%0A        return convertView;%0D%0A    %7D%0D%0A%0D%0A    @SuppressWarnings(%22unchecked%22)%0D%0A    @Override%0D%0A    public View getDropDownView(int position, View convertView, ViewGroup parent) %7B%0D%0A        ViewHolder%3CItemType%3E holder = null;%0D%0A%0D%0A        if (convertView != null && convertView.getTag() instanceof ViewHolder) %7B%0D%0A            try %7B%0D%0A                holder = (ViewHolder%3CItemType%3E) convertView.getTag();%0D%0A            %7D catch (ClassCastException e) %7B%0D%0A                Log.e(TAG, Log.getStackTraceString(e));%0D%0A            %7D%0D%0A        %7D%0D%0A%0D%0A        if (holder == null) %7B%0D%0A            convertView = LayoutInflater.from(getContext())%0D%0A                    .inflate(getDropDownItemLayoutRes(position), parent, false);%0D%0A            holder = constructDropDownHolder(convertView);%0D%0A        %7D%0D%0A%0D%0A        holder.apply(getItem(position), position);%0D%0A        return convertView;%0D%0A    %7D%0D%0A%0D%0A    @SuppressWarnings(%22UnusedParameters%22)%0D%0A    protected int getItemLayoutRes(int position) %7B%0D%0A        return itemLayoutRes;%0D%0A    %7D%0D%0A%0D%0A    @SuppressWarnings(%22UnusedParameters%22)%0D%0A    protected int getDropDownItemLayoutRes(int position) %7B%0D%0A        return dropDownItemLayoutRes;%0D%0A    %7D%0D%0A%0D%0A    protected abstract ViewHolder%3CItemType%3E constructHolder(View view);%0D%0A%0D%0A    protected abstract ViewHolder%3CItemType%3E constructDropDownHolder(View view);%0D%0A%0D%0A    public interface ViewHolder%3CT%3E %7B%0D%0A%0D%0A        void apply(T item, int position);%0D%0A    %7D%0D%0A%7D%0D%0A

Add adapter for drop downs (e.g. spinners)