mercredi 2 septembre 2015

Android viewHolder CursorAdapter CheckBox not work

Hy,

my English is very bad...

Androd SQLite display data read from a CursorAdapter class and a ListView in ViewHolder-in instead. I wanted a checkbox for each line, which can put specific updates the database record. The thing does not work well because when I activate the first line checkbox you change that appear on the screen last line record.

long _id = todo.getID(); //

checkBoxFavorite.setTag(_id);
checkBoxFavorite.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) 
    {
        //Update database row
        }
        else if (!isChecked)
        {
        //Update database row
        }
    }
});

Aucun commentaire:

Enregistrer un commentaire