title: android grid view with text and images
body: <p>I want to create a grid view where the there are 7 columns in  total. The 1st row in grid is text, which is dynamic and the successive rows contain images, which are also dynamic. 1st I tried with the dynamic images alone and was successful but after the addition of text view I'm getting errors.</p>
  
  <p>My adapter for grid view goes like</p>
  
  <pre><code>private Context mContext;
  private int[] colors = new int[] { Color.WHITE, 0x30aaaaaa };
  private int[] dotColors = new int[7];
  private int[] sta= new int[100];
  private TasksDataSource datasource;
  private int con=1000;
  TextView textview1;
  public Integer[] mThumbIds = new Integer[con];
  String[] dday = {"S","M","T","W","T","F","S"};
  int[] day7;
  
  public ImageAdapter(Context context, int[] content,int[] content2){
      sta = content;
      day7=content2;
      datasource = new TasksDataSource(context); //here
      datasource.open(); 
      mContext=context;
  }s
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      int[] st = new int[sta.length];
      int ii=0,jj=0;
      View myView  = null;
      if(convertView==null) {
          LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          myView = li.inflate(R.layout.gridmenu, null);
      }else{
          myView = convertView;
      }
  
      TextView tv = (TextView) myView.findViewById(R.id.grid_item_text);
      if(position&lt;7) {
          tv.setText(dday[position]);
          tv.setTextColor(day7[position]);
      }
      else {
          ImageView imageView =(ImageView) myView.findViewById(R.id.grid_item_image);
          imageView.setImageResource(sta[position]);
          imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      }
  
      return myView;
  }
  </code></pre>
  
  <p>My grid layout goes like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/GridItem"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:gravity="center_horizontal"&gt;
  
      &lt;TextView android:id="@+id/grid_item_text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center_horizontal"
          android:layout_centerHorizontal="true"&gt;
      &lt;/TextView&gt;
  
      &lt;ImageView android:id="@+id/grid_item_image"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"&gt;
      &lt;/ImageView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The problem I get is the images are not proper. They are lost. Is my code correct while handling the positions?</p>