I use my ArrayAdapter expanded getView method. I change CheckBox but the ListView does not refresh
my source
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Planet to display
UrlItem urlItem = (UrlItem) this.getItem(position);
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.database_table_item, null);
viewHolder = new ViewHolder();
viewHolder.checkbox = (CheckBox) convertView
.findViewById(R.id.checkBox1);
viewHolder.checkbox
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
int getPosition = (Integer) buttonView.getTag();
DatabaseTable.setPosition(getPosition);
for (int i = 0; i < UrlItems.size(); i ++ ) {
UrlItems.get(i).setUse(false);
}
UrlItems.get(getPosition).setUse(isChecked);
}
});
How can I refresh the list after changes ??
for your information in the manifest set
<activity
android:name=".DatabaseTable"
android:label="database_table" android:windowSoftInputMode="adjustPan" >
See the link for the upgrade using the button "selectAll" I have exact same idea but without the button selectAll
notify that the data set have changed ; )
Note: If you get any errors with the above line, you could try the following code (where mListView is the name of my ListView object)
Another way would be to invalidate the List so that it is redrawn form the updated data set once again.