@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(getApplicationContext(),
R.layout.grid_item, null);
holder.iv = (ImageView) convertView
.findViewById(R.id.main_item_iv);
holder.tv = (TextView) convertView
.findViewById(R.id.main_item_tv_title);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.iv.setImageResource(item_icons[position]);
holder.tv.setText(item_names[position]);
return convertView;
}
}
class ViewHolder {
TextView tv;
ImageView iv;
}