title: Displaying text in gridview dynamically using 2D array for android
body: <p>I currently have a gridview inside of a scroll view that where I would like to display information
  from a 2D array inside the grid view and have it scrollable. I created an adapter for the gridView to handle this job as I would like to use it for other layout later. The problem I am encountering is that only the 1st row of the array and a portion of the second is being displayed in the grid view. 
  Here is my code for the adapter I created and I feel the problem lies somewhere within it:</p>
  
  <pre><code>public class GridViewAdapter extends BaseAdapter
  {
      private Context context;
      String[][] gridContent;
      int rowPosition, columnPosition, count;
  
  
      /**
       * 
       */
      public GridViewAdapter(Context c, String[][] content) 
      {
          // TODO Auto-generated constructor stub
          context = c;
          count = 0;
          gridContent = new String[content.length][content[0].length];
          for (int i = 0; i &lt; gridContent.length; i++)
          {
              for (int j = 0; j &lt; gridContent[i].length; j++)
              {
                  gridContent[i][j] = content[i][j];
                  count++;
              }
          }
          rowPosition = 0;
          columnPosition = 0;
      }
  
      public int getCount()
      {
          return count;
      }
  
      public int getRowCount()
      {
          return gridContent.length;
      }
  
      public int getColumnCount()
      {
          return gridContent[0].length;
      }
  
      public Object getItem(int rowNum, int columnNum)
      {
          return gridContent[rowNum][columnNum];
      }
  
      public View getView(int position, View view, ViewGroup group)
      {
          TextView textView;
          if (view == null)
          {
              textView = new TextView(context);
              //textView.setPadding(8, 8, 8, 8);
          }
          else
          {
              textView = (TextView) view;
          }
          columnPosition = position % gridContent[0].length;
          rowPosition = (position - columnPosition)/gridContent[0].length;
          textView.setText(gridContent[rowPosition][columnPosition]);
          //textView.setTextColor(000000);
          //textView.setTextSize(13);     
  
          return textView;
      }
  
  
      public Object getItem(int position) 
      {
          return null;
      }
  
      public long getItemId(int position) 
      {
          return 0;
      }
  
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.
  THank You</p>
  
  <p>I don't understand why it works perfectly fine for the 1st row and part of the second but
  then it gets cut off. Here is my xml code for the scrollview and gridview:</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/verticalScrollView"
          android:layout_width="fill_parent"
          android:layout_height="400dp"
          android:overScrollMode="always"
          android:isScrollContainer="true"
          android:scrollbarAlwaysDrawVerticalTrack="true"
          android:scrollbars="vertical"
          android:layout_alignParentLeft="true"
          android:layout_below="@+id/networkResults" &gt;
  
          &lt;GridView
              android:id="@+id/scheduleGrid"
              android:layout_width="fill_parent"
              android:layout_height="match_parent"
              android:gravity="left"
              android:horizontalSpacing="10dp"
              android:isScrollContainer="true"
              android:numColumns="5"
              android:stretchMode="columnWidth"
              android:verticalSpacing="10dp" &gt;
  
          &lt;/GridView&gt;
      &lt;/ScrollView&gt;
  </code></pre>