title: How to get a checkbox value using custom adapter and listview
body: <p>I am trying to get a checked value but it is not showing the value, I have implemented custom adapter there i am not getting how to update position</p>
  
  <p>My code is..</p>
  
  <pre><code>   public Add_member_adapter(Context a, ArrayList&lt;ItemsModel&gt; d) {
  
          context = a;
          data = d;
          itemChecked = new boolean[data.size()];
  
          inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      }
  
      public int getCount() {
          if (data.size() &lt;= 0)
              return 1;
          return data.size();
      }
  
      public final Object getItem(int position) {
          return data.get(getCount() - position - 1);
      }
  
      public final long getItemId(int position) {
          return position;
      }
  
      public static class ViewHolder {
  
          public TextView Name, UserId_Fk;
          CheckBox chkbox;
  
      }
  
      public View getView(final int position, View convertView, ViewGroup parent) {
  
          Log.d("getview:", "position=" + position);
          vi = convertView;
          final ViewHolder holder;
  
          if (convertView == null) {
  
              vi = inflater.inflate(R.layout.add_members_list_item, null);
              holder = new ViewHolder();
  
              holder.Name = (TextView) vi.findViewById(R.id.Name);
              holder.UserId_Fk = (TextView) vi.findViewById(R.id.CusId_Fk);
              holder.chkbox = (CheckBox) vi.findViewById(R.id.chkbox);
  
              vi.setTag(holder);
          } else {
  
              holder = (ViewHolder) vi.getTag();
  
          }
          if (data.size() &lt;= 0) {
  
              vi.setVisibility(View.GONE);
  
          } else {
  
              tempValues = null;
              tempValues = (ItemsModel) data.get(position);
  
              holder.Name.setText(tempValues.getItemName().toString());
              holder.UserId_Fk.setText(tempValues.getUserId_Fk().toString());
              holder.chkbox.setChecked(false);
  
  
  
              holder.chkbox.setChecked(itemChecked[position]);
  
              holder.chkbox
                      .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                          @Override
                          public void onCheckedChanged(CompoundButton buttonView,
                                  boolean isChecked) {
                              itemChecked[position] = isChecked;
                          }
                      });
          }
          return vi;
      }
  </code></pre>
  
  <p>and i am declaring List setOnItemClickListener another in activity</p>
  
  <pre><code>list.setOnItemClickListener(new OnItemClickListener() {
  
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
  
                  CheckBox checkbox = ((CheckBox) view.findViewById(R.id.chkbox));
  
                  String Name = list.getItemAtPosition(position).toString();
  
  
  
              }
  
          });
  </code></pre>