package andronGames.gamesUtil; import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class MyListAdapter extends ArrayAdapter { private final LayoutInflater inflater; private int itemShablon; public MyListAdapter(Context context, int itemShablon, List values) { super(context, itemShablon, values); this.itemShablon = itemShablon; inflater = LayoutInflater.from(context); } public View getView(int position, View view, ViewGroup parent) { final ViewHolder holder; if (view == null) { view = inflater.inflate(itemShablon, parent, false); holder = new ViewHolder(); holder.label = (TextView) view.findViewById(R.id.labelList); holder.icon = (ImageView) view.findViewById(R.id.iconList); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } holder.label.setText(getItem(position)); holder.icon.setImageResource(R.drawable.exit_icon); return view; } private static class ViewHolder { TextView label; ImageView icon; } }