cb_select_all.setOnCheckedChangeListener(new OnCheckedChangeListener() {
     @Override
     public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                     int count = lv.getChildCount();
                     for(int i = 0; i < count; i++){
                             RelativeLayout layout = (RelativeLayout)lv.getChildAt(i);
                             int c = layout.getChildCount();
                             for(int j = 0; j < c; j++){
                                     View view = layout.getChildAt(j);
                                     if(view instanceof CheckBox){
                                             ((CheckBox)view).setChecked(isChecked);
                                             break;
                                     }
                             }
                     }
     }
    });