title: how to update the display of my CheckBox items in my ListView marked as check?
body: <p>When I first run my app, the <code>CheckBox</code> items in my <code>ListView</code> are unchecked. In my <code>layout.xml</code> I have a single <code>CheckBox</code> above my <code>ListView</code> items. When that single <code>CheckBox</code> above my <code>ListView</code> is checked it should mark all the <code>CheckBox</code> items in my <code>ListView</code> as checked. My code below does not update the display of my <code>CheckBox</code> items in my <code>ListView</code> as checked but when I tried to get the boolean of each <code>CheckBox</code> item in my <code>ListView</code> by calling <code>checkItem.isChecked()</code> and let it display in my <code>logcat</code>, it returns true. Did I miss something?</p>
  
  <pre><code>package com.usjr.sss.fragment;
  
  import java.util.ArrayList;
  import com.usjr.sss.R;
  import com.usjr.sss.activity.CourseFragmentActivity;
  import com.usjr.sss.adapter.InfoTechAdapter;
  import com.usjr.sss.adapter.SubjectDbAdapter;
  import android.database.Cursor;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.ViewGroup;
  import android.widget.CheckBox;
  import android.widget.ListView;
  import android.widget.Toast;
  
  public class InfoTechFirstYearFragment extends Fragment {
  
  private CheckBox checkFirstYearFirstSem;
  private ListView listItFirstYearFirstSem;
  private ListView listItFirstYearSecondSem;
  private InfoTechAdapter infoTechAdapter;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      return inflater.inflate(R.layout.fragment_it_first_year, container,
              false);
  }
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      Log.i("InfoTechFirstYearFragment", "onActivityCreated");
  
      listItFirstYearFirstSem = (ListView) getActivity().findViewById(
              R.id.listItFirstYearFirstSem);
      listItFirstYearSecondSem = (ListView) getActivity().findViewById(
              R.id.listItFirstYearSecondSem);
  }
  
  @Override
  public void onStart() {
      super.onStart();
      Log.i("InfoTechFirstYearFragment", "onStart");
  
      SubjectDbAdapter subjectDbAdapter = new SubjectDbAdapter(getActivity());
      subjectDbAdapter.open();
  
      Cursor cursor = subjectDbAdapter.fetchAllSubjects();
      ArrayList&lt;String&gt; arrayListSubject = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; arrayListFirstSem = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; arrayListSecondSem = new ArrayList&lt;String&gt;();
  
      while (cursor.moveToNext()) {
          String subject = cursor.getString(cursor
                  .getColumnIndexOrThrow(SubjectDbAdapter.SUBJECT_ID));
          arrayListSubject.add(subject);
      }// end while
  
      subjectDbAdapter.close();
  
      int index;
  
      /**
       * 1st yr 1st sem
       */
      for (index = 0; index &lt; 9; index++) {
          arrayListFirstSem.add(arrayListSubject.get(index));
      }
  
      infoTechAdapter = new InfoTechAdapter(
              (CourseFragmentActivity) getActivity(), arrayListFirstSem);
      listItFirstYearFirstSem.setAdapter(infoTechAdapter);
  
      /**
       * 1st yr 2nd sem
       */
      for (index = 9; index &lt; 18; index++) {
          arrayListSecondSem.add(arrayListSubject.get(index));
      }
  
      infoTechAdapter = new InfoTechAdapter(
              (CourseFragmentActivity) getActivity(), arrayListSecondSem);
      listItFirstYearSecondSem.setAdapter(infoTechAdapter);
  
      /**
       * MARK ALL THE CHECKBOX AS CHECKED
       */
      checkFirstYearFirstSem = (CheckBox) getActivity().findViewById(
              R.id.checkFirstYearFirstSem);
      checkFirstYearFirstSem.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View v) {
              if (checkFirstYearFirstSem.isChecked()) {
                  Toast.makeText(getActivity(), "ckecked", Toast.LENGTH_SHORT)
                          .show();
                  int count = listItFirstYearFirstSem.getCount();
                  for (int index = 0; index &lt; count; index++) {
  
                      // View viewMy =
                      // listItFirstYearFirstSem.getChildAt(index);
                      // Object id = v.getTag();
  
                      View viewItem = (View) listItFirstYearFirstSem
                              .getAdapter().getView(index, getView(),
                                      listItFirstYearFirstSem);
                      CheckBox checkItem = (CheckBox) viewItem
                              .findViewById(R.id.subject);
                      checkItem.setChecked(true);
  
                      listItFirstYearFirstSem.setItemChecked(index, true);
  
                      infoTechAdapter.notifyDataSetChanged();
                      Log.i("checkItem",
                              String.valueOf(checkItem.getText().toString()));
                      Log.i("checkItem",
                              String.valueOf(checkItem.isChecked()));
                  }
  
              } else {
                  Toast.makeText(getActivity(), "unckecked",
                          Toast.LENGTH_SHORT).show();
              }// end if-else(checkFirstYearFirstSem.isChecked())
          }// end onClick
      });// end OnClickListener
  }// end onStart()
  }
  </code></pre>