title: Android ViewHolder pattern with programmatically added views
body: <p>I'm creating a FrameLayout and then I add two Views (an ImageView and a TextView ).</p>
  
  <p>My code on getView() :</p>
  
  <pre><code>  public View getView(int position, View convertView, ViewGroup parent) {
      ImageView imageView;
      TextView textView1;
  
      int new_width = wid/2;
      int textview_id=0;
  
      FrameLayout frame_layout = new FrameLayout(mContext);  // Instantiate the parent
      frame_layout.setLayoutParams(new GridView.LayoutParams(android.widget.FrameLayout.LayoutParams.MATCH_PARENT, 
                      android.widget.FrameLayout.LayoutParams.MATCH_PARENT));
  
      textView1 = new TextView(mContext); textView1.setId(position); 
      textView1.setText("Set Wallpaper");
      textView1.setTextColor(mContext.getResources().getColor(R.color.set_wallpaper_colors));
      textView1.setVisibility(View.INVISIBLE);
      textView1.setTypeface(textView1.getTypeface(), Typeface.BOLD);
  
  
      FrameLayout.LayoutParams textview_params = new FrameLayout.LayoutParams(
              LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
      textview_params.gravity = Gravity.CENTER;
  
  
      FrameLayout.LayoutParams imageview_params = new FrameLayout.LayoutParams(
              new_width -5, new_width -5 );
  
  
          imageView = new ImageView(mContext);
          //imageView.setLayoutParams(new GridView.LayoutParams(new_width - 5, new_width -5));
          imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
          imageView.setPadding(0, 0, 0, 0);
  
  
      imageView.setImageResource(mThumbIds[position]);
  
      frame_layout.addView(imageView, imageview_params);
      frame_layout.addView(textView1, textview_params);
  
      return frame_layout;
  }
  </code></pre>
  
  <p>How should I change it to use the ViewHolder class. There isn't a layout to inflate.</p>