add Check Box to TableLayout - Android android.widget

Android examples for android.widget:TableLayout

Description

add Check Box to TableLayout

Demo Code

import android.content.Context;
import android.widget.CheckBox;
import android.widget.TableLayout;

public class Main {

  public static CheckBox[] addCheckBox(Context ctx, TableLayout parent, String... options) {
    int cnt = options.length;
    CheckBox[] cbx = new CheckBox[cnt];
    int i = 0;//  w ww .  j a  va2s.co  m
    for (String o : options) {
      cbx[i] = new CheckBox(ctx);
      cbx[i].setText(o);
      parent.addView(cbx[i]);
      i++;
    }
    return cbx;
  }

}

Related Tutorials