listview with checkbox status changed when scoll
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7738527/getting-an-issue-while-checking-the-dynamically-generated-checkbox-through-list">Getting an issue while checking the dynamically generated checkbox through list view</a>  </p>
</blockquote>



<p>I have listview with checkboxes.Bydefault all checkboxes are checked.After that some checkboxes unchecked and sroll those checkboxes are checked automatically.But i want after scroll the listview those checkboxes are checked.
My code is:</p>

<pre><code>public class  FriendListAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    DrunkMessages friendsList;
    boolean[] checkBoxState;

    public FriendListAdapter(DrunkMessages friendsList) {
        this.friendsList = friendsList;
        if (Utility.model == null) {
            Utility.model = new FriendsGetProfilePics();
        }
        Utility.model.setListener(this);
        mInflater = LayoutInflater.from(friendsList.getBaseContext());

        checkBoxState=new boolean[jsonArray.length()];
    }


    public int getCount() {
        return jsonArray.length();
    }


    public Object getItem(int position) {
        return null;
    }


    public long getItemId(int position) {
        return 0;
    }

    public View getView(final int position, View convertView, ViewGroup parent) {

            View hView = getLayoutInflater().inflate(R.layout.friendslist, null);

            ImageView profile_pic = (ImageView) hView.findViewById(R.id.profile_pic);
            TextView name = (TextView) hView.findViewById(R.id.name);

            final CheckBox checkbox=(CheckBox)hView.findViewById(R.id.checkbox);

        profile_pic.setImageBitmap(Utility.model.getImage(friendid[position], pictures[position]));
        name.setText(names[position]);

        checkbox.setOnClickListener(new View.OnClickListener() {

               public void onClick(View v) {
                if(((CheckBox)v).isChecked()){

                checkBoxState[position]=true;
                status[position]="1";

             Log.e("checked","checked");
            Log.e("Checked",status[position]);
                }
                else{
                 checkBoxState[position]=false;
                status[position]="0";

                Log.e("checked","unchecked");
             Log.e("Checked",status[position]);

                }
               }
               });

      return hView;
}
</code></pre>
