title: How to "fill" some parts only from the total number of GridView items?
body: <p>I have this problem where I wanted to fill some parts only of the GridView depending on the number I give to it. Here's the image:</p>
  
  <p><img src="https://i.stack.imgur.com/LuRYN.png" alt="enter image description here"></p>
  
  <p>If I give 3 only out of 8, 3 of the <code>GridView</code> items should be highlighted. <strong>Note that 8 is fixed!</strong> I have all the code and the custom adapter, I'm confused on which part do I check and give the <code>GridView</code> 3 of them should only be highlighted.</p>
  
  <p>Here's where I set the custom adapter in my activity:</p>
  
  <blockquote>
  <pre><code>    Integer[] lessons = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8};
      CustomAdapter gridViewAdapter = new CustomAdapter(this, R.layout.item_lessons, lessons);
      gridView.setAdapter(gridViewAdapter);
  </code></pre>
  </blockquote>
  
  <p>My CustomAdapter:</p>
  
  <blockquote>
  <pre><code>  @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          View row = convertView;
          ViewHolder holder = null;
          if (row == null) {
              LayoutInflater inflater = ((Activity) context).getLayoutInflater();
              row = inflater.inflate(resource, parent, false);
              holder = new ViewHolder();
              holder.tvLessons = (TextView) row
                      .findViewById(R.id.lesson_module);
              row.setTag(holder);
          } else {
              holder = (ViewHolder) row.getTag();
          } holder.tvLessons.setBackgroundResource(R.drawable.icon_lesson_filled);
          return row;
      }
      public class ViewHolder {
          public TextView tvLessons;
      }
  </code></pre>
  </blockquote>