1
I have a Gridview Adapter and in it I possess a ImageButton
to delete items. It is deleting correctly, however, every time an item is deleted I need to set the current quantity in one TextView
that is in another Activity
. I can’t catch the event from GridView
directly, because it has other clickable components, your touch has been disabled:
Follow the code snippet where I delete the item and try to pass the current amount of items to the TextView
present in my Activity
:
holder.imgDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Integer position = (Integer)v.getTag();
Produto_Valor newList[] = new Produto_Valor[values.length - 1];
int count = 0;
for (int i = 0; i < values.length; i++) {
if (values.length - 1 > 0) {
if (values[i] == values[1]) {
} else {
newList[count] = values[i];
count++;
}
}
}
values = newList;
notifyDataSetChanged();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.activity_pedidos, null);
final TextView txtTotal = (TextView) view.findViewById(R.id.lbl_QtdeDados);
new Thread (new Runnable(){
@Override
public void run(){
txtTotal.setText(String.valueOf(values.length));
}
}).start();
}
});
You have solved the problem Fabio, or you need some more information?
– viana