first of all, let me show you the code I have in order to do what the title says.

But before, this is how the actitivy looks:

<http://i.imgur.com/UzexgEA.jpg>

Ignore the buttons, already managed to hide both of them, only check boxes in each row are left.

My activity layout (the one in the screenshot) is:

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/findSelected"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="registrarAsistencia"
        android:text="Registrar Asistencia" />

    <ListView
        android:id="@+id/listaAlumnos"
        android:layout_width="fill_parent"
        android:layout_height="376dp"
        android:layout_weight="2.29" />

    <Button
        android:id="@+id/btnChecarBoxes"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="seleccionarTodosNinguno"
        android:text="Seleccionar / Deseleccionar todo" />

</LinearLayout>

```

And here it is the layout for the list's contents:

```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

  <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:orientation="vertical" >

      <TextView
          android:id="@+id/rowTextView"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:padding="10dp"
          android:textSize="16sp" 
          android:textStyle="bold"/>

      <TextView
          android:id="@+id/rowTextView2"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:padding="10dp"
          android:textSize="16sp" 
          android:textStyle="italic"/>

  </LinearLayout>

  <CheckBox
      android:id="@+id/CheckBox01"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_alignParentRight="true"
      android:layout_centerVertical="true"
      android:focusable="false"
      android:padding="10dp" />
</RelativeLayout>

```

I mentioned before that the buttons and check boxes needs to be hidden, this will happen ONLY if certain conditions are met.

I have added to the list view a setOnItemClickListener, which contains the following code:

```
mainListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View item, int position, long id) {
                    final Alumno Alumno = listAdapter.getItem(position);
                if(!verEstadisticas){                   
                    Alumno.toggleChecked();         
                    Toast.makeText(AlumnosAsistencia.this, Alumno.getNoControl() + " " + Alumno.getName(), Toast.LENGTH_LONG).show();
                    final AlumnoViewHolder viewHolder = (AlumnoViewHolder) item.getTag();
                    viewHolder.getCheckBox().setChecked(Alumno.isChecked());
                    runOnUiThread(new Runnable() {
                        public void run() {             
                            viewHolder.getCheckBox().setVisibility(View.GONE);
                        }
                    });
                }else{                      
                    // Here Im supposed to do something else, but check boxes needs to be hidden
                }               
            }
        });

```

This is the code for AlumnoViewHolder:

```
class AlumnoViewHolder {
    private CheckBox checkBox;
    private TextView textView1;
    private TextView textView2;

    public AlumnoViewHolder() {
    }

    public AlumnoViewHolder(TextView textView1, TextView textView2, CheckBox checkBox) {
        this.checkBox = checkBox;
        this.textView1 = textView1;
        this.textView2 = textView2;
    }

    public CheckBox getCheckBox() {
        return checkBox;
    }

    public void setCheckBox(CheckBox checkBox) {
        this.checkBox = checkBox;
    }

    public TextView getTextView1() {
        return textView1;
    }

    public void setTextView1(TextView textView1) {
        this.textView1 = textView1;
    }

    public TextView getTextView2() {
        return textView2;
    }

    public void setTextView2(TextView textView2) {
        this.textView2 = textView2;
    }
}

```

As you can see I can hide check boxes only by clicking its row, where I get the View item parameter and the item.getTag() method, however, I cant find a way to do this outside of the onItemClick method. I Googled for solutions and found this:

```
for(int i=0; i < mainListView.getCount(); i++){
                        RelativeLayout itemLayout = (RelativeLayout) mainListView.getChildAt(i);
                        CheckBox cb = (CheckBox) itemLayout.findViewById(R.id.CheckBox01);
                        cb.setVisibility(View.GONE);
                    }

```

However, It didnt work.

Also, I have other minor issue. In the screenshot you can see the activity. Now, if I check a check box and then scroll down, "moving" the check box outside of the screen, and then scroll up to that check box again, the check box would be unchecked, meaning that it didnt save it's status. How can I make sure that it "remembers" its status once it is outside of the screen?

Excuse my english and way to explain things, haha.

Would appreciate all the help possible. Thanks in advance!