Я пытаюсь удалить элемент из массива с именем arrayofTask, установив флажок.Я пробовал много способов сделать это, но безуспешно.
Посетите https://imgur.com/gallery/oRdhpGR, где я загрузил изображение моего списка, в которое я добавляю задачу и описание с помощью кнопки добавления.
Я пытаюсь удалить это.Задача и описание с нажатием кнопки-флажка
ниже - это то, что я пытался сделать, но я не знаю, как продолжить.
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (checkBox.isChecked()){
///i want to delete the arrayoftasks thats located in this location.
///tho i am unable to get the location for the tasks in this location.
///so if i check the box it should delete the items
}
}
});
это мой пользовательский адаптер
public class userAdapter extends ArrayAdapter<user> {
public userAdapter(Context context, ArrayList<user> users){
super(context,0,users);
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
final user User = getItem(position);
CheckBox checkbox;
if(convertView == null){
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);
}
///this new
checkbox = (CheckBox) convertView.findViewById(R.id.checkbox);
///above
TextView tvTask = (TextView) convertView.findViewById(R.id.task);
TextView tvDescription = (TextView) convertView.findViewById(R.id.description);
tvTask.setText(User.task);
tvDescription.setText(User.description);
return convertView;
}