I'm having difficulties when spreading the data I receive on the ListView

Assume I receive a list as:
list(String category, String name, String details, String isSection)
and I have

```
list.add("Drink", "Water", "Fresh Water", false)
list.add("Drink", "Cola", "8oZ", false)
list.add("Food", "Burger", "Homemade", false)

```

etc...

Now, when I call the adapter, the GetView method gets called. I implemented it as:

```
public class EntryRestaurantAdapter extends ArrayAdapter<RestaurantMenu> {

    private Context context;
    private ArrayList<RestaurantMenu> items;
    private LayoutInflater vi;
    private static final int TYPE_SECTION = 1;
    private static final int TYPE_ITEM = 2;

    public EntryRestaurantAdapter(Context context,ArrayList<RestaurantMenu> items) {
        super(context,0, items);
        this.context = context;
        this.items = items;
        vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getViewTypeCount () {
        return 2;
    }

    @Override
    public int getItemViewType(int position) {
        return items.get(position).getSection() ? TYPE_SECTION : TYPE_ITEM;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;

        final RestaurantMenu i = items.get(position);

        if (!i.getSection()){
            RestaurantMenu si = (RestaurantMenu)i;
            v = vi.inflate(R.layout.list_item_section, null);

            v.setOnClickListener(null);
            v.setOnLongClickListener(null);
            v.setLongClickable(false);

            final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
            sectionView.setText(si.getCategory());

            for (int a=0; a<items.size(); a++){
//                if (items.indexOf(i.getCategory()) == items.lastIndexOf(i.getCategory()))
//                    v = vi.inflate(R.layout.item_view, null);
                if (i.getCategory().equals(items.get(a).getCategory())){
                    Log.d("Dentro del FOr ",""+ items.get(a).getSection());

                    items.get(a).setSection(true);
                    Log.d("Dentro del FOr despues del true ",""+ items.get(a).getSection());

                }
            }
        }
    else {

            v = vi.inflate(R.layout.item_view, null);

            TextView sectionView = (TextView) v.findViewById(R.id.restaurant_name);
            RestaurantMenu si = (RestaurantMenu) i;
            sectionView.setText(si.getFoodName());
        }

        Log.d("Entry Section: ", "" + i.getSection() + " ID: " + i.getCategory());
        return v;
    }

```

I called on my main activity as:

```
 EntryRestaurantAdapter adapter = new EntryRestaurantAdapter(this, restaurantMenuList);

        listview.setAdapter(adapter);

```

This works, but it omits the first one of each category. I think it happens because the getView method runs obviously ONCE for each position. This causes that it returns the v as a category and not as an item on the first try of each category. How can I fix this?

this is the output

Category: Drink
Item Cola (it omitted the item view of water)
Category: Food (it omitted the item view of burger)