1 @Override 2 public View getView(int position, View convertView, ViewGroup parent) { 3 View view; 4 Holder holder; 5 6 if (convertView == null) { 7 view = View.inflate(MainActivity.this, R.layout.item, null); 8 holder = new Holder(); 9 holder.img = (ImageView) view.findViewById(R.id.img); 10 holder.button1 = (Button) view.findViewById(R.id.button1); 11 holder.button2 = (Button) view.findViewById(R.id.button2); 12 view.setTag(holder); 13 } else { 14 view = convertView; 15 holder = (Holder) view.getTag(); 16 } 17 18 return view; 19 }