Gridview missing an item
<p>I need a gridview to show 9 items. I've written a custom baseadapter.</p>

<p>However, I have a problem with the position in the <code>getView</code> method. It looks like this gridview misses the 7th item. The code looks like this:</p>

<pre><code>public class ImageAdapter extends BaseAdapter {
private Hashtable&lt;String, LayoutDTO&gt; menuHashtable =  Global.menuHashtable;
private LayoutInflater mInflater;

public ImageAdapter(Context context) {
    this.mInflater = LayoutInflater.from(context);
}

@Override
public int getCount() {
    //Log.v("size........", Integer.toString(menuHashtable.size()));
    return menuHashtable.size();
}

@Override
public Object getItem(int position) {
    return menuHashtable.get(Integer.toString(position));
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutDTO lDto = menuHashtable.get(Integer.toString(position));
    ViewHolder vHolder = new ViewHolder();
    //if (convertView == null) {
        if (lDto != null) {
            String titleString = lDto.getTitle();
            Bitmap iconBitmap = lDto.getIcon();
            convertView = mInflater.inflate(R.layout.custombutton, null);
            vHolder.icon = (ImageView) convertView
                    .findViewById(R.id.imageicon);
            vHolder.icon.setImageBitmap(iconBitmap);
            vHolder.text = (TextView) convertView
                    .findViewById(R.id.icontitle);
            int index = titleString.indexOf("\u0026");
            if (index != -1) {
                String title1 = titleString.substring(0, index + 1).trim();
                String title2 = titleString.substring(index + 1,
                        titleString.length()).trim();
                vHolder.text.setLines(2);
                String newtitle = title1 + "\n" + title2;
                vHolder.text.setText(newtitle);
            } else {
                vHolder.text.setLines(2);
                String newtitle = titleString + "\n" + " ";
                vHolder.text.setText(newtitle);
            }
            convertView.setTag(vHolder);
        }
        else{
            Log.v("null........",Integer.toString(position));
        }

    return convertView;
}

private class ViewHolder {
    ImageView icon;
    TextView text;
}
</code></pre>

<p>}</p>

<p>The log shows this:</p>

<pre><code>05-20 21:37:16.066: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.105: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.125: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.135: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.166: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.185: VERBOSE/title...........(158): Entertainment  1
05-20 21:37:16.195: VERBOSE/title...........(158): Shopping  2
05-20 21:37:16.195: VERBOSE/title...........(158): Fashion  3
05-20 21:37:16.205: VERBOSE/title...........(158): Health &amp; Beauty  4
05-20 21:37:16.215: VERBOSE/title...........(158): Supermarkets  5
05-20 21:37:16.226: VERBOSE/title...........(158): Auto Services  6
05-20 21:37:16.236: VERBOSE/title...........(158): Travel &amp; Accommodation  8
05-20 21:37:16.316: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.326: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.336: VERBOSE/title...........(158): Dining  0
05-20 21:37:16.345: VERBOSE/title...........(158): Dining  0
</code></pre>
