title: android listview , the checkbox change random
body: <p>i have a listview with checkbox on each row , when i select any checkbox and then scroll the screen , the checkboxes for each item changed ranomally , i mean the uncheck it becomse check and sometimes it stay uncheck , and then when i scroll up again , the checked one becomes uncheck , i found this question <a href="https://stackoverflow.com/questions/5444355/android-listview-with-checkbox-problem">Android listview with checkbox problem</a> , and the users says it helps them, but i can't understand what sholud i do , and help please </p>
  
  <p> this is my adapter</p>
  
  <pre><code>class RestaurantAdapter extends BaseAdapter {
      private static LayoutInflater inflater = null;
      private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
      Activity activity;
  
      public RestaurantAdapter(Activity activity,
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; data) {
          // TODO Auto-generated constructor stub
          this.activity = activity;
          this.data = data;
          inflater = (LayoutInflater) activity
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return data.size();
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          View vi = convertView;
          if (vi == null)
              vi = inflater.inflate(R.layout.restaurant_multi_select_list_item,
                      null);
          TextView name = (TextView) vi
                  .findViewById(R.id.restaurant_multi_select_title);
          ImageView image = (ImageView) vi
                  .findViewById(R.id.restaurant_multi_select_list_item_image);
          CheckBox cb = (CheckBox) vi
                  .findViewById(R.id.restaurant_multi_select_checkBox);
          HashMap&lt;String, String&gt; restaurant = data.get(position);
          name.setText(restaurant.get("name"));
  
          image.setImageResource(Integer.parseInt(restaurant.get("image")));
          return vi;
  
      }
  }
  </code></pre>