0
I’m trying to remove the listview item, but when I test the app does nothing... My class Productoadapter:
public class ProdutoAdapter extends ArrayAdapter<Carrinho_Item> {
private Context context;
private List<Carrinho_Item> item;
public ProdutoAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List<Carrinho_Item> objects) {
super(context, resource, objects);
this.context = context;
this.item = objects;
}
@Override
public View getView(final int pos, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.list_carrinho, parent, false);
TextView txtCodigo = (TextView) rowView.findViewById(R.id.txtCodigoDoProduto);
TextView txtDescricao = (TextView) rowView.findViewById(R.id.txtProduto);
TextView txtCor = (TextView) rowView.findViewById(R.id.txtCor);
TextView txtTamanho = (TextView) rowView.findViewById(R.id.txtTamanho);
TextView txtQuantidade = (TextView) rowView.findViewById(R.id.txtQuantidade);
txtCodigo.setText(""+item.get(pos).getCodigo());
txtDescricao.setText(item.get(pos).getNome());
txtCor.setText(""+item.get(pos).getCor());
txtTamanho.setText(item.get(pos).getTamanho());
txtQuantidade.setText(""+item.get(pos).getQuantidade());
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
item.remove(item.get(pos));
}
});
return rowView;
}
}
Vlw bro, save ! It worked here
– Daniel
Great! Don’t forget to mark the answer as solution.
– Mathias Berwig