How to get the id's of selected checkboxes which are displaying dynamically in android?
<p>In my project I am <strong>displaying the checkboxes dynamically</strong>. But I want to get the id values of all the <strong>checkboxes that are selected</strong>. In my application the user will select multiple checkboxes and I need to store those selected checkboxes id's in an arraylist. <strong>How can I get the selected checkboxes id's?</strong></p>

<p>My Code:</p>

<pre><code> public View getView(int position, View convertView, ViewGroup parent) 
{
  View view = convertView;
  try
  {
  if (view == null) 
   {
    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = vi.inflate(R.layout.list_item1, null); 
    }
    final UserBO listItem = mList.get(position);            
    if (listItem != null) 
      {

    Rl = (LinearLayout)findViewById(R.id.chklnlayout);

    ArrayList&lt;UserBO&gt; mList1;

    CheckBox[] cbs = new CheckBox[20]; 

    for(int k=0; k&lt;list.size(); k++)
    { 
     System.out.println("list in for loop"+list.get(0));
     arr = list.get(k);
     cbs[k] = new CheckBox(getContext());
     Rl.addView(cbs[k]);
     cbs[k].setText((CharSequence) arr.get(2));
     cbs[k].setTextColor(Color.parseColor("#000000"));  
    } 

   }
}
catch(Exception e){
  String err = (e.getMessage()==null)?"hii":e.getMessage();
  Log.e("sdcard-err2:",err);  
}
return view;
}
</code></pre>

<p>Please help me regarding this....Thanks in Advance</p>
