title: Holder for an Adapter
body: <p>I have a gridView in which I am populating a data using a custom Adapter. For that I have overridden the getView() method. However, as my gridView is a custom one, I had to use a static holder class(as seen in many examples provided online). If I do not wish to use the holder what other way can I implement it in? And why are getTag() and setTag() used? I searched about them but couldn't find sufficient explanation.</p>
  
  <p>The Holder Class -</p>
  
  <pre><code>static class RecordHolder{
      ImageView imgView;
      TextView txtView;
  }
  </code></pre>
  
  <p>The getView method - </p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      RecordHolder holder = new RecordHolder();
      if (convertView == null) {
          LayoutInflater inflater = (getActivity()).getLayoutInflater();
          row = inflater.inflate(R.layout.grid_line, parent, false);
  
          holder.imgView = (ImageView) row.findViewById(R.id.imageView);
          holder.txtView = (TextView) row.findViewById(R.id.textView);
  
          row.setTag(holder);
      } else {
          holder = (RecordHolder) row.getTag();
      }
  
      ResolveInfo resolveInfo = mAppList.get(position);
      holder.imgView.setImageDrawable(resolveInfo.loadIcon(getActivity().getPackageManager()));
      holder.txtView.setText(resolveInfo.loadLabel(getActivity().getPackageManager()));
  
      return row;
  
  }
  </code></pre>