Even if I try to remove the Adapter element using a custom model with adapter.remove (item), it does not disappear.
Bad example
@Override
public void onItemClick(final AdapterView<?> adapterView, View view, final int i, long l) {
            OriginalItem item = (OriginalItem) mItemAdapter.getItem(i);
            mItemAdapter.remove(item);
            list.setAdapter(mItemAdapter);
}
This will not be deleted.
So, implement the delete function in your custom Adapter class.
ItemAdapter.java
//abridgement
public void delete(int pos){
        itemList.remove(pos);
}
//abridgement
The ItemList that holds the elements of the custom Adapter is of type ArrayList <>, so you can delete it with position.
All you have to do is call this.
Implementation example
@Override
public void onItemClick(final AdapterView<?> adapterView, View view, final int i, long l) {
            mItemAdapter.delete(i);
            list.setAdapter(mItemAdapter);
}
        Recommended Posts