vendredi 17 mars 2017

Keep checked animation of checkbox, when I remove the object from ListView in Adapter

Can somebody help me solve this problem? I want to remove the object from ListView in Adapter, when the Check Box is checked. But the checked animation disappear, because it start animation after I remove the object. This is sample code for that.

public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    chkDone = (CheckBox) row.findViewById(R.id.chkDone);
    chkDone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b){
                editDone(object,MainActivity.pagePosition, position);
                //I remove the object item in ArrayList in this procedure
                //I have already called notifyDataSetChanged() in this procedure
            }
        }
    });

}}




Aucun commentaire:

Enregistrer un commentaire