title: Custom Gridview in fragment not populating
body: <p>I'm trying to create a custom gridview inside a fragment that should look something like this: </p>
  
  <p><a href="http://imgur.com/6fEFYTN" rel="nofollow">http://imgur.com/6fEFYTN</a></p>
  
  <p>So I created a FragmentLayout that contains the image and the label:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical" &gt;
  
      &lt;ImageView
      android:id="@+id/grid_image"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="top"
       /&gt;
  
      &lt;TextView
          android:id="@+id/grid_label"
          android:layout_width="fill_parent"
          android:layout_height="45dp"
          android:layout_marginTop="175dp"    
          android:background="@drawable/label"
          android:gravity="center"
          android:textColor="#FFFFFF"
          android:textSize="12sp"
          android:textStyle="bold" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>The adapter that manages the FragmentLayout looks like this:</p>
  
  <pre><code>public class CustomGridAdapter extends BaseAdapter{
  
  private Context mContext;
  private final String[] label;
  private final int[] imgId;
    public CustomGridAdapter(Context c,String[] label,int[] imgId ) {
        mContext = c;
        this.imgId = imgId;
        this.label = label;
    }
  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      return 0;
  }
  
  @Override
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return null;
  }
  
  @Override
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return 0;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
  
      View grid;
        LayoutInflater inflater = (LayoutInflater) mContext
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            if (convertView == null) {
              grid = new View(mContext);
          grid = inflater.inflate(R.layout.image_button_layout, null);
              TextView textView = (TextView) grid.findViewById(R.id.grid_label);
              ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
              textView.setText(label[position]);
              imageView.setImageResource(imgId[position]);
            } else {
              grid = (View) convertView;
            }
        return grid;
  }   
  </code></pre>
  
  <p>}</p>
  
  <p>The fragment grid is as follows:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"&gt;
  
  &lt;GridView
      android:numColumns="auto_fit"
      android:gravity="center"
      android:columnWidth="90dp"
      android:stretchMode="columnWidth"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/form_grid"
      android:verticalSpacing="10dp"
      android:horizontalSpacing="10dp"
       /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I'm creating this from the onCreateView method, I'm using onclickListener so the images work as buttons and display a toast when pressed:</p>
  
  <pre><code> @Override
  public View onCreateView(final LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_layout_softdrinks, container, false);
  
      GridView grid = (GridView) rootView.findViewById(R.id.form_grid);
  
      CustomGridAdapter adapter = new CustomGridAdapter(rootView.getContext(), label, imgId); //label and imgId are arrays containing strings and int respectively
  
      grid.setAdapter(adapter);
  
      grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                  int position, long id) {
              Toast.makeText(inflater.getContext(), "You Clicked at " +label[+ position], Toast.LENGTH_SHORT).show();
          }
      });
  
      return rootView;        
  }
  </code></pre>
  
  <p>The problem is that when I run the code, the screen is blank, so the gridview is not being populated.
  Any advice on this?</p>