title: Custome BaseAdapter position in getView is always 0
body: <p>Hello i try to use my own adapter on <code>Gridview</code>.</p>
  
  <p>My problem is that the position in getView is not increasing.</p>
  
  <p>This is my code:</p>
  
  <pre><code> public class WorkourLogBuilder {
  
       String[] values = new String[11];
       Context mContext;
       Map&lt;Integer, String[]&gt; valuesArray;
       int rowsCount = 0;
       int mode;
       int adappterRowsCount = 0;
  
       static final int AEROBIC = 1;
       static final int ANAEROBIC = 0;
  
       public WorkourLogBuilder(Context context, int modeChoosed)
       {
           mContext = context;
           mode = modeChoosed;
           valuesArray = new HashMap&lt;Integer, String[]&gt;();
       }
  
       public void commintRow()
       {
           valuesArray.put(rowsCount, values);
  
           rowsCount++;
  
           Log.i("rowsCount", rowsCount+"");
  
           values = new String[11];
       }
  
       public void setWorkoutWeight(String value)
       {
           values[0] = value;
       }
  
       public void setSets(String value)
       {
           values[1] = value;
       }
  
       public void setReps(String value)
       {
           values[2] = value;
       }
  
       public void setWorkTime(String value)
       {
           values[3] = value;
       }
  
       public void setWDayTime(String value)
       {
           values[4] = value;
       }
  
       public void setDistance(String value)
       {
           values[5] = value;
       }
  
       public void setSpeed(String value)
       {
           values[6] = value;
       }
  
       public void setRestTime(String value)
       {
           values[7] = value;
       }
  
  
       public void setCaloires(String value)
       {
           values[8] = value;
       }
  
       public void setHeartBeat(String value)
       {
           values[9] = value;
       }
  
       public void setComment(String value)
       {
           values[10] = value;
       }
  
  
       public View build()
       {
           LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
  
           View v = inflater.inflate(R.layout.workout_log_row, null, false);
  
           GridView grid = (GridView) v.findViewById(R.id.table);
  
           Log.i("count", valuesArray.size()+"");
  
           grid.setAdapter(new ImageAdapter());
  
           return v;
       }
  
          public class ImageAdapter extends BaseAdapter {
  
              public int getCount() {
  
                  return (valuesArray.size()+6);
              }
  
              public Object getItem(int position) {
                  return valuesArray.get(position);
              }
  
              public long getItemId(int position) {
                  return position;
              }
  
  
              public View getView(int position, View convertView, ViewGroup parent) {
  
                  Log.i("position", position+"");
  
                  if(position &lt; 6)
                  {
                      ImageView image = new ImageView(mContext);
  
                      if(position &lt; 3)
                          image.setImageDrawable(mContext.getResources().getDrawable(R.drawable.small_green_apple));
                      else
                          image.setImageDrawable(mContext.getResources().getDrawable(R.drawable.anonymous));
  
                      image.setScaleType(ImageView.ScaleType.FIT_XY);
                      return image;
                  }
  
                  TextView textValue = new TextView(mContext);
  
                  textValue.setTextColor(Color.BLACK);
  
                  GridView.LayoutParams lp = new GridView.LayoutParams(GridView.LayoutParams.WRAP_CONTENT, GridView.LayoutParams.MATCH_PARENT);
                  textValue.setLayoutParams(lp);
  
                  String[] currecntRow = valuesArray.get(adappterRowsCount);
  
                  switch(position % 6)
                  {
                    case 0:
                    {
                        if(adappterRowsCount != 6)
                            adappterRowsCount++;
  
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[5]);
                        else
                            textValue.setText(currecntRow[0]);
  
                        break;
                    }
  
                    case 1:
                    {
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[3]);
                        else
                            textValue.setText(currecntRow[2]);
                        break;
                    }
  
  
                    case 2:
                    {
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[6]);
                        else
                            textValue.setText(currecntRow[1]);
                        break;
                    }
  
                    case 3:
                    {
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[1]);
                        else
                            textValue.setText(currecntRow[7]);
                        break;
                    }
  
  
                    case 4:
                    {
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[7]);
                        else
                            textValue.setText(currecntRow[3]);
                        break;
                    }
  
                    case 5:
                    {
                        if(mode == AEROBIC)
                            textValue.setText(currecntRow[10]);
                        else
                            textValue.setText(currecntRow[10]);
                        break;
                    }
                  }
  
  
                  return textValue;
              }
  
  
          }`enter code h
  </code></pre>
  
  <p>The XML code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;GridView
          android:id="@+id/table"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:numColumns="6" &gt;
      &lt;/GridView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is where i use <code>WorkourLogBuilder</code> class</p>
  
  <pre><code>public void setTheLogViewTest(String date)
      {
          String[][] values = data.dayLog(date);
  
          ArrayList&lt;ExpandListGroup&gt; listAll = new ArrayList&lt;ExpandListGroup&gt;();
          ArrayList&lt;ExpandListChild&gt; listChilds = new ArrayList&lt;ExpandListChild&gt;();
          ExpandListGroup group = new ExpandListGroup();
          ExpandListChild child = new ExpandListChild();
  
          int length = values[0].length;
  
          WorkourLogBuilder builder = null;
  
          for(int i = 0; i &lt; length; i++)
          {
              String exrcise = values[3][i];
  
              String restTime;
              String setTime;
              String weight;
              String reps;
              String comment;
              String sets;
              String speed;
              String distance;
  
              if (values[9][i] == null || values[9][i].equals(""))
                  speed = mResources.getString(R.string.Undefined);
              else {
                  if (data.getUnits().equals("metric"))
                      speed = values[9][i] + " " + mResources.getString(R.string.km_hour);
                  else
                      speed = values[9][i] + " " + mResources.getString(R.string.miles_hour);
              }
  
              if (values[10][i] == null || values[10][i].equals(""))
                  restTime = mResources.getString(R.string.Undefined);
              else
                  restTime = getTimesPharsed(values[10][i]);
  
              if (values[6][i] == null || values[6][i].equals(""))
                  setTime = mResources.getString(R.string.Undefined);
              else
                  setTime = getTimesPharsed(values[6][i]);
  
  
              if (values[4][i] == null || values[4][i].equals(""))
                  weight = mResources.getString(R.string.Undefined);
              else {
                  if (data.getUnits().equals("metric"))
                      weight = values[4][i] + " " + mResources.getString(R.string.kg);
                  else
                      weight = values[4][i] + " " + mResources.getString(R.string.lbs);
              }
  
              if (values[5][i] == null || values[5][i].equals(""))
                  reps = mResources.getString(R.string.Undefined);
              else
                  reps = values[5][i];
  
              if (values[11][i] == null || values[11][i].equals(""))
                  comment = mResources.getString(R.string.Undefined);
              else
                  comment = values[11][i];
  
              if (values[12][i] == null || values[12][i].equals(""))
                  sets = mResources.getString(R.string.Undefined);
              else
                  sets = values[12][i] + checkForFailedSets(values[1][i]);
  
              if (values[8][i] == null || values[8][i].equals(""))
                  distance = mResources.getString(R.string.Undefined);
              else {
                  if (data.getUnits().equals("metric"))
                      distance = values[8][i] + " " + mResources.getString(R.string.km);
                  else
                      distance = values[8][i] + " " + mResources.getString(R.string.miles);
              }
  
              if(i == 0)
              {
                  group = new ExpandListGroup();
                  group.setName(exrcise, this);
  
                   Log.i("test", "1");
  
                  if(data.getAerobic(exrcise))
                      builder = new WorkourLogBuilder(this, ANAEROBIC);
                  else
                      builder = new WorkourLogBuilder(this, AEROBIC);
  
                  builder.setWorkoutWeight(weight);
                  builder.setReps(reps);
                  builder.setSets(sets);
                  builder.setWorkTime(setTime);
                  builder.setRestTime(restTime);
                  builder.setComment(comment);                    
                  builder.setDistance(distance);
                  builder.setSpeed(speed);
                  builder.commintRow();
  
              }
  
              else if (i &gt; 0 &amp;&amp; exrcise.equals(values[3][i - 1]) == false &amp;&amp; i == length - 1 == false) 
              {
  
                   Log.i("test", "2");
  
                  View v = builder.build();
  
                  child = new ExpandListChild();
  
                  child.setLayouts((RelativeLayout) v);
                  listChilds.add(child);
  
                  group.setItems(listChilds);
                  listAll.add(group);
  
                  group = new ExpandListGroup();
                  group.setName(exrcise, this);
  
                  if(data.getAerobic(exrcise))
                      builder = new WorkourLogBuilder(this, ANAEROBIC);
                  else
                      builder = new WorkourLogBuilder(this, AEROBIC);
  
                  builder.setWorkoutWeight(weight);
                  builder.setReps(reps);
                  builder.setSets(sets);
                  builder.setWorkTime(setTime);
                  builder.setRestTime(restTime);
                  builder.setComment(comment);                    
                  builder.setDistance(distance);
                  builder.setSpeed(speed);
                  builder.commintRow();
  
                }
  
              else if (i == length - 1 &amp;&amp; exrcise.equals(values[3][i - 1]) == false)  
              {
                   Log.i("test", "3");
  
                  View v = builder.build();
  
                  child = new ExpandListChild();
                  child.setLayouts((RelativeLayout) v);
                  listChilds.add(child);
  
                  group.setItems(listChilds);
                  listAll.add(group);
  
                  group = new ExpandListGroup();
                  group.setName(exrcise, this);
  
                  if(data.getAerobic(exrcise))
                      builder = new WorkourLogBuilder(this, ANAEROBIC);
                  else
                      builder = new WorkourLogBuilder(this, AEROBIC);
  
                      builder.setWorkoutWeight(weight);
                      builder.setReps(reps);
                      builder.setSets(sets);
                      builder.setWorkTime(setTime);
                      builder.setRestTime(restTime);
                      builder.setComment(comment);            
                      builder.setDistance(distance);
                      builder.setSpeed(speed);
                      builder.commintRow();
  
                  v = builder.build();
  
                  child = new ExpandListChild();
                  child.setLayouts((RelativeLayout) v);
                  listChilds.add(child);
  
                  group.setItems(listChilds);
                  listAll.add(group);
  
              }
  
              else if (i == length - 1 &amp;&amp; exrcise.equals(values[3][i - 1]) == true)
              {
                   Log.i("test", "4");
  
                   if(data.getAerobic(exrcise))
                          builder = new WorkourLogBuilder(this, ANAEROBIC);
                      else
                          builder = new WorkourLogBuilder(this, AEROBIC);
  
                          builder.setWorkoutWeight(weight);
                          builder.setReps(reps);
                          builder.setSets(sets);
                          builder.setWorkTime(setTime);
                          builder.setRestTime(restTime);
                          builder.setComment(comment);                    
                          builder.setDistance(distance);
                          builder.setSpeed(speed);
                          builder.commintRow();
  
                  View v = builder.build();
  
                  child = new ExpandListChild();
                  child.setLayouts((RelativeLayout) v);
                  listChilds.add(child);
  
                  group.setItems(listChilds);
                  listAll.add(group);
              }
  
              else
              {
                   Log.i("test", "5");
  
                   builder.setWorkoutWeight(weight);
                      builder.setReps(reps);
                      builder.setSets(sets);
                      builder.setWorkTime(setTime);
                      builder.setRestTime(restTime);
                      builder.setComment(comment);                    
                      builder.setDistance(distance);
                      builder.setSpeed(speed);
                      builder.commintRow();
              }
  
          }
  
          ExpAdapter = new ExpandListAdapter(DatePage.this, listAll);
          ExpandList.setAdapter(ExpAdapter);
  
      } 
  </code></pre>
  
  <p>When i look at the logcat i that the position log is always 0.</p>
  
  <p>Why position is not increasing?</p>