您可以在适配器中实现自定义接口。当您从列表中选择项目时,您必须将结果传递给您的活动,然后您可以对其进行汇总。
interface CheckItemList{
public void onCheckItem(int value){}
}
CheckItemList checkItemList = (CheckItemList) mContext;
satView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
if(isChecked){
checkItemList.onCheckItem(value);
}
}
}
);
class MyActivity extends Activity implements CheckItemList.
onCheckItem(int value){
//Add your code to store checked value
}
}