title: Multiple calling of getView() in GridView
body: <p>My Activity consists of GridView which holds 40+ elements. After starting activity user could see maximum 15 items (3 rows, 5 items in each row). I wrote in getView() body to pass to the LogCat number of getting View:</p>
  <pre><code>Log.i(&quot;getView()&quot;, &quot;GETTING VIEW_POSITION[&quot; + String.valueOf(position) + &quot;]&quot; + (convertView != null?convertView.toString():&quot;null&quot;));
  </code></pre>
  <p>After launching my app I get such log:</p>
  <pre><code>02-09 14:34:56.900: INFO/getView()(388): GETTING VIEW_POSITION[0]null
  02-09 14:34:57.300: INFO/getView()(388): GETTING VIEW_POSITION[0]android.widget.FrameLayout@44c7a9c0  
  02-09 14:34:57.300: INFO/getView()(388): GETTING VIEW_POSITION[1]null
  02-09 14:34:57.400: INFO/getView()(388): GETTING VIEW_POSITION[2]null
  02-09 14:34:57.510: INFO/getView()(388): GETTING VIEW_POSITION[3]null
  02-09 14:34:57.620: INFO/getView()(388): GETTING VIEW_POSITION[4]null
  02-09 14:34:57.720: INFO/getView()(388): GETTING VIEW_POSITION[5]null
  02-09 14:34:57.840: INFO/getView()(388): GETTING VIEW_POSITION[6]null
  02-09 14:34:57.930: INFO/getView()(388): GETTING VIEW_POSITION[7]null
  02-09 14:34:58.273: DEBUG/dalvikvm(388): GC freed 3530 objects / 322744 bytes in 270ms
  02-09 14:34:58.280: INFO/getView()(388): GETTING VIEW_POSITION[8]null
  02-09 14:34:58.300: INFO/getView()(388): GETTING VIEW_POSITION[9]null
  02-09 14:34:58.320: INFO/getView()(388): GETTING VIEW_POSITION[10]null
  02-09 14:34:58.340: INFO/getView()(388): GETTING VIEW_POSITION[11]null
  02-09 14:34:58.360: INFO/getView()(388): GETTING VIEW_POSITION[12]null
  02-09 14:34:58.380: INFO/getView()(388): GETTING VIEW_POSITION[13]null
  02-09 14:34:58.400: INFO/getView()(388): GETTING VIEW_POSITION[14]null
  02-09 14:34:59.220: INFO/getView()(388): GETTING VIEW_POSITION[0]null
  02-09 14:34:59.490: INFO/getView()(388): GETTING VIEW_POSITION[0]android.widget.FrameLayout@44c69ef0
  </code></pre>
  <p>I also red <a href="http://code.google.com/p/android/issues/detail?id=12889" rel="noreferrer">this</a> post about such kind of issue. But My GridView's height in XML  description set as fill parent:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  
  &lt;GridView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
                  android:id=&quot;@+id/grid&quot;
                  android:layout_width=&quot;fill_parent&quot; 
                  android:layout_height=&quot;fill_parent&quot;
                  android:numColumns=&quot;auto_fit&quot;
                  android:horizontalSpacing=&quot;10dp&quot;
                  android:verticalSpacing=&quot;10dp&quot;
                  android:columnWidth=&quot;140dp&quot;
                  android:gravity=&quot;center&quot;
                  android:scrollbars=&quot;none&quot;
                  /&gt; 
  </code></pre>
  <p>And finally to remove all doubts, here is my Adapter code:</p>
  <pre><code>public class ImageAdapter extends BaseAdapter
      {
          private Activity activity;
          private LayoutInflater inflater = null;
          private ArrayList&lt;Photo&gt; photoes;
          
          public ImageAdapter(Activity a, ArrayList&lt;Photo&gt; pictures)
          {
              photoes = pictures;
              activity = a;
              inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent)
          {
              Log.i(&quot;getView()&quot;, &quot;GETTING VIEW_POSITION[&quot; + String.valueOf(position) + &quot;]&quot; + (convertView != null?convertView.toString():&quot;null&quot;));
                  View mViewSlice = convertView;
                  if(convertView == null) {
                      mViewSlice = inflater.inflate(R.layout.photo_preview, null);
                      ((TextView) mViewSlice.findViewById(R.id.name_of_photo)).setText(photoes.get(position).getName());
                      
                      mViewSlice.setPadding(5, 5, 5, 5);
                      mViewSlice.setLayoutParams(new GridView.LayoutParams(-2, -2));
                      
                  }
          
                 
                        
                 return mViewSlice;
          }
  
          @Override
          public int getCount() {
              return photoes.size();
          }
  
          @Override
          public Object getItem(int position) {
              return photoes.get(position);
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }   
      }
  </code></pre>
  <p>I hope somebody will respond at my problem and will help me to solve it.</p>
  <p>Waiting for your suggestions. Alex.</p>