Last active
February 2, 2016 02:19
-
-
Save vuhung3990/26e947dd963e3727efa5 to your computer and use it in GitHub Desktop.
solved issui checkbox state in listview scroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Contructor () | |
// StaticVar.java contain 'Expand_State' var | |
private List<ItemObject> list; | |
private int current_size; | |
StaticVar.Expand_State = new boolean[list.size()]; | |
current_size = list.size(); | |
// end Contructor-------------------------------- | |
// @override Getview() | |
if(current_size != list.size()){ | |
current_size = list.size(); | |
boolean[] clone_state = StaticVar.Expand_State.clone(); | |
StaticVar.Expand_State = new boolean[list.size()]; | |
for(int i=0;i<clone_state.length;i++){ | |
// if not out of bound Expand_State && clone_state[i] = true | |
if(i < StaticVar.Expand_State.length && clone_state[i]){ | |
StaticVar.Expand_State[i] = clone_state[i]; // = true | |
} | |
} | |
} | |
// .........some coe here..........// | |
CheckBox checkbox = (CheckBox)convertView.findViewById(R.id.expand_btn); | |
checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { | |
@Override | |
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | |
StaticVar.Expand_State[position] = isChecked; | |
} | |
}); | |
checkbox.setChecked(StaticVar.Expand_State[position]); | |
// end Getview()---------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment