title: How to check if checkbox is checked or unchecked in android application?
body: <p>I need to find out a way how to retrieve checked state for checkboxes created with code listed below:</p>
  
  <pre><code>for (int i = 0; i &lt; cnt; i++) {
                      cb = new CheckBox(getApplicationContext());
                      TextView txt = new TextView(getApplicationContext());
                      final LinearLayout ll2 = new LinearLayout(
                              PollActivity.this);
                      ll2.setOrientation(LinearLayout.HORIZONTAL);
                      ll2.addView(txt);
                      ll2.addView(cb);
                      txt.setText(PersianReshape
                              .reshape(last_poll_array[i][1]));
                      txt.setTypeface(face);
                      ll.setGravity(Gravity.RIGHT);
                      ll2.setGravity(Gravity.RIGHT);
                      ll.addView(ll2);
  
                  }
                  sc.addView(ll);
  </code></pre>
  
  <p>Any guidance will be appreciated.</p>