IconListAdapterpublic class IconListAdapter extends android.widget.ArrayAdapter An adapter to store icons. |
Fields Summary |
---|
protected android.view.LayoutInflater | mInflater | private static final int | mResource |
Constructors Summary |
---|
public IconListAdapter(android.content.Context context, List items)
super(context, mResource, items);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
Methods Summary |
---|
public android.view.View | getView(int position, android.view.View convertView, android.view.ViewGroup parent)
TextView text;
ImageView image;
View view;
if (convertView == null) {
view = mInflater.inflate(mResource, parent, false);
} else {
view = convertView;
}
// Set text field
text = (TextView) view.findViewById(R.id.text1);
text.setText(getItem(position).getTitle());
// Set resource icon
image = (ImageView) view.findViewById(R.id.icon);
image.setImageResource(getItem(position).getResource());
return view;
|
|