updating listview when data is removed from the arrayadapter

Im creating a listView and setting a custom arrayAdapter to it in my main activity. Using an onClickListener within the getView method of the adapter to try and remove the item clicked. Its being removed from the array in the adapter but i cant make the listview refresh to show that using notifyDataSetChanged.
Ive tried using an onItemClickListener in the main activity instead but i can only get that to work by setting the items in the object view to not clickable which wont work because of the checkboxes.
ive tried calling notifyDataSetChanged in the onClickListener in getView, at the end of getView itself but neither do anything.
the only way ive gotten the listview to change is creating a new instance of the adapter and setting the listview again which i do in the main activity to add new items, but i dont know if i could do that from the adapter and i cant set onClick for the listview in main activity because of above.
i know the data is being removed from the array because the log lines ADAPTER ONCLICK START and END show the removal, but i cannot find a way to update the screen at that moment.

heres the main activity

public class MainActivity extends AppCompatActivity {
    CustomAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ArrayList<TaskModel> tasks = read();
        //listview
        ListView listView = findViewById(R.id.task_list);
        adapter = new CustomAdapter(this, tasks);
        listView.setAdapter(adapter);
        //add button
        Button addButton = findViewById(R.id.add_button);
        addButton.setOnClickListener(v -> {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            View mView = getLayoutInflater().inflate(R.layout.add_dialog,null);
            final EditText txt_inputText = mView.findViewById(R.id.editText);
            builder.setView(mView);
            builder.setMessage("add a new item").setPositiveButton("Add", (dialog, which) -> {
                //do the add here
                Log.d("NEW START", String.valueOf(tasks.size()));
                tasks.add(new TaskModel(txt_inputText.getText().toString(), false));
                write(tasks);
                adapter = new CustomAdapter(this, tasks);
                listView.setAdapter(adapter);
                Toast.makeText(getApplicationContext(),"new item added",Toast.LENGTH_SHORT).show();
                Log.d("NEW END", String.valueOf(tasks.size()));
            }).setNegativeButton("Cancel", (dialog, which) -> Toast.makeText(getApplicationContext(),"new item cancelled",Toast.LENGTH_SHORT).show());
            AlertDialog alert = builder.create();
            alert.show();
        });
    }
}

and the adapter

public class CustomAdapter extends ArrayAdapter{
    Context mContext;
    ArrayList<TaskModel> data;
    public CustomAdapter(Context context, ArrayList<TaskModel> data) {
        super(context, R.layout.list_item, data);
        this.mContext = context;
        this.data = data;
    }

    public static class ViewHolder{
        TextView txtName;
        CheckBox chkBox;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        Log.d("ADAPTER START", String.valueOf(data.size()));
        TaskModel model = (TaskModel) getItem(position);
        ViewHolder viewHolder;
        if(convertView == null){
            viewHolder = new ViewHolder();
            LayoutInflater inflater = LayoutInflater.from(getContext());
            convertView = inflater.inflate(R.layout.list_item, parent, false);
            viewHolder.txtName = convertView.findViewById(R.id.textView);
            viewHolder.chkBox = convertView.findViewById(R.id.checkBox);
            convertView.setTag(viewHolder);
        }else{
            viewHolder = (ViewHolder) convertView.getTag();
        }
            viewHolder.txtName.setOnClickListener(v -> {
                Log.d("ADAPTER ONCLICK START", String.valueOf(data.size()));
                for(int i =0; i < data.size(); i++){
                    if(viewHolder.txtName.getText().equals(data.get(i).name)){
                        data.remove(i);
                    }
                }
                write(data);
                refresh();
                Log.d("ADAPTER ONCLICK END", String.valueOf(data.size()));
            });
        viewHolder.chkBox.setOnCheckedChangeListener((buttonView, isChecked)->{
            if(isChecked){
                //do checked

            }else{
                //do unchecked

            }
        });

        viewHolder.txtName.setText(model.name);
        viewHolder.chkBox.setChecked(model.done);
        return convertView;
    }
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật