title: Checkbox geting unchecked after scrolling Custom listview...!
body: <p>I Create custom listview, and put checkbox in it.<br>at First I check all checkbox and then I scroll down listview, then checkbox getting Unchecked. <br>what should I do?<br>
  CustomListItem.java
  <br></p>
  
  <pre><code>package com.example.customlistviewdemo;
  
  import android.app.Activity;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.CheckBox;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class CustomListItem extends ArrayAdapter&lt;String&gt; {
  
      private final Activity context;
      private final String[] TitleArray;
      private final String[] SubTitlearray;
      private final String[] TimeArray;
      private final Integer[] MainImageId;
  
  
      public CustomListItem(Activity context, String[] TitleArray,
              String[] SubTitlearray, String[] TimeArray, Integer[] MainImageId) {
          super(context, R.layout.list_item, TitleArray);
          this.context = context;
          this.TitleArray = TitleArray;
  
          this.SubTitlearray = SubTitlearray;
          this.TimeArray = TimeArray;
          this.MainImageId = MainImageId;
  
  
      }
  
      @Override
      public View getView(int position, View view, ViewGroup parent) {
          LayoutInflater inflater = context.getLayoutInflater();
          View rowView = inflater.inflate(R.layout.list_item, null, true);
          ImageView animal, car, environment, map1, warning1, map2, warning2, download, share, plant;
          animal = (ImageView) rowView.findViewById(R.id.imgAnimal);
          car = (ImageView) rowView.findViewById(R.id.imgCar);
          environment = (ImageView) rowView.findViewById(R.id.imgEnvironment);
          plant = (ImageView) rowView.findViewById(R.id.imgPlant);
          map1 = (ImageView) rowView.findViewById(R.id.imgMap);
          warning1 = (ImageView) rowView.findViewById(R.id.imgWarning);
          map2 = (ImageView) rowView.findViewById(R.id.imgMap2);
          warning2 = (ImageView) rowView.findViewById(R.id.imgWarining2);
          download = (ImageView) rowView.findViewById(R.id.imgDownload);
          CheckBox chk = (CheckBox) rowView.findViewById(R.id.checkbox);
          share = (ImageView) rowView.findViewById(R.id.imgShare);
  
          animal.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Toast.makeText(getContext(), "Animal ImageView is Clicked",
                          5000).show();
                  // TODO Auto-generated method stub
  
              }
          });
          car.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Toast.makeText(getContext(), "Cars ImageView is Clicked", 5000)
                          .show();
                  // TODO Auto-generated method stub
  
              }
          });
          environment.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Toast.makeText(getContext(),
                          "environment ImageView is Clicked", 5000).show();
                  // TODO Auto-generated method stub
  
              }
          });
          ------------------------------------------------------------------
                        ...........................SO on............................
                          ..........................................................
  
          TextView mainTitle = (TextView) rowView.findViewById(R.id.txtMainTitle);
          ImageView mainImage = (ImageView) rowView
                  .findViewById(R.id.imgMainImage);
  
          TextView SubText = (TextView) rowView.findViewById(R.id.txtSubTitle);
          TextView TimeText = (TextView) rowView.findViewById(R.id.txtTimeTitle);
  
          mainTitle.setText(TitleArray[position]);
          SubText.setText(SubTitlearray[position]);
          TimeText.setText(TimeArray[position]);
          mainImage.setImageResource(MainImageId[position]);
  
          return rowView;
      }
  }
  </code></pre>
  
  <p><br>
  ActivityMain.java
  <br>    </p>
  
  <pre><code>package com.example.customlistviewdemo;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.ListView;
  
  public class MainActivity extends Activity {
      ListView list;
      String[] TitleArray = { "Testing Title1. This is MainTitle",
              "Testing Title2. This is MainTitle",
              "Testing Title3. This is MainTitle",
              "Testing Title4. This is MainTitle",
              "Testing Title5. This is MainTitle",
              "Testing Title6. This is MainTitle" };
      String[] SubTitleArray = { "Reported by Man 1", "Reported by Man 2",
              "Reported by Man 3", "Reported by Man 4", "Reported by Man 5",
              "Reported by Man 6" };
  
      String[] TimeArray = { "about 1 hour ago", "about 2 hour ago",
              "about 3 hour ago", "about 4 hour ago", "about 5 hour ago",
              "about 6 hour ago" };
  
      Integer[] MainImageId = { R.drawable.android1, R.drawable.android2,
              R.drawable.android3, R.drawable.android4, R.drawable.android5,
              R.drawable.android6 };
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          CustomListItem adapter = new CustomListItem(MainActivity.this,
                  TitleArray, SubTitleArray, TimeArray, MainImageId);
          list = (ListView) findViewById(R.id.listView1);
          list.setAdapter(adapter);
  
      }
  }
  </code></pre>
  
  <p><br>
  list_item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="#FFF"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="10dp" &gt;
  
          &lt;TextView
              android:id="@+id/txtMainTitle"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="This is Sample Text"
              android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" &gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="130dp" &gt;
  
          &lt;LinearLayout
              android:layout_width="150dp"
              android:layout_height="wrap_content"
              android:paddingRight="15dp" &gt;
  
              &lt;CheckBox
                  android:layout_width="wrap_content"
                  android:layout_height="fill_parent" /&gt;
  
              &lt;ImageView
                  android:id="@+id/imgMainImage"
                  android:layout_width="100dp"
                  android:layout_height="fill_parent" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical" &gt;
  
              &lt;TextView
                  android:id="@+id/txtSubTitle"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="5dp"
                  android:text="This is Sample Text"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textSize="16dp" /&gt;
  
              &lt;TextView
                  android:id="@+id/txtTimeTitle"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="This is Sample Text"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textSize="12dp" /&gt;
  
              &lt;HorizontalScrollView
                  android:id="@+id/scrollView1"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:scrollbars="none" &gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="8dp"
                      android:layout_marginTop="8dp" &gt;
  
                      &lt;ImageView
                          android:id="@+id/imgAnimal"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/channel_animal" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgCar"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/channel_car" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgEnvironment"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/channel_environment" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgPlant"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/channel_plant" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgMap"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/tab_icon_map" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgWarning"
                          android:layout_width="25dp"
                          android:layout_height="25dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/warning_icon" /&gt;
                  &lt;/LinearLayout&gt;
              &lt;/HorizontalScrollView&gt;
  
              &lt;HorizontalScrollView
                  android:id="@+id/scrollView2"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:scrollbars="none" &gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content" &gt;
  
                      &lt;ImageView
                          android:id="@+id/imgMap2"
                          android:layout_width="30dp"
                          android:layout_height="30dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/tab_icon_map" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgWarining2"
                          android:layout_width="30dp"
                          android:layout_height="30dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/warning_icon" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgDownload"
                          android:layout_width="30dp"
                          android:layout_height="30dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/download_icon" /&gt;
  
                      &lt;ImageView
                          android:id="@+id/imgShare"
                          android:layout_width="30dp"
                          android:layout_height="30dp"
                          android:layout_marginRight="10dp"
                          android:src="@drawable/share_icon" /&gt;
                  &lt;/LinearLayout&gt;
              &lt;/HorizontalScrollView&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;View
              android:id="@+id/view"
              android:layout_width="match_parent"
              android:layout_height="1dp"
              android:layout_toRightOf="@+id/text1"
              android:background="#FF9900" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>