Android ExpandableListView with multiple CheckBox

3.5k Views Asked by At

How to get multiple checkbox values in android expandable list view?

2

There are 2 best solutions below

0
On

I'm not 100% sure, as I've yet to do this myself, but I would try making your ListView item, (the layout you use as what is in each list item) a drawer, and go from there, I would assume you'd like to populate them depending on if you need them or not, so I would using something along the lines of

 final Button btnLogin = new Button(this);
  btnLogin.setText("Login");
  btnLogin.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  btnLogin.setGravity(Gravity.CENTER);
  btnLogin.setOnClickListener(new View.OnClickListener() {
    public void onClick(View view) {
      new GetDataFromServlet().execute(NetworkActivity.this);
      Log.i(getClass().getSimpleName(), "button was pressed");
    }
  });

But as a checkbox, not a button

0
On

Here's an example program that implements checkboxes in ExpandableListView: mylifewithandroid.blogspot.com: Expandable lists and check boxes