samedi 14 mai 2016

ListView in ListView with Custom Adapter

I am trying to build a ListView (Class ListView ) in android application every item of this ListView Contains CheckBox and TextView (class Name) and Anothor ListView (Section ListView) I build two custom adapters one to fill Class ListView and the other Section ListView my problem is that i fill the class listview from my activity by making an object off its addapter but the other one need first to check if the checkbox is checked to be filled so i need to write its code inside onclickListener of that checkbox inside the adapter class inside it i will write the bellow code in my classAdapter class in getView method

`

ListView sectionListView = (ListView ) convertView.findViewByID(R.id.secLV);

CheckBox chb = (CheckBox) convertView.findViewById(R.id.chBoxClss);

chb.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View v) {
     if (chb.isChecked()) {             
      sectionAdapter a = new SectionAdapter (context,SectionList );
      sectionListView.setAdapter (a);
            }
          }
        }
     );

`

I know that my wrong is on the SectionAdapter object on the first parameter the context but i try to change it to different values but all are wrong i think that i have to reffere to the parent ListView = classListview but i dont know how




Aucun commentaire:

Enregistrer un commentaire