BaseAdapter を拡張する ListView で値をレンダリングするアダプターがあります。このアダプタは、アクティビティで呼び出されます。アクティビティには、アダプタで onClickListener が呼び出されたときに更新する必要がある TextView があります。アダプターでボタンがクリックされた場合に TextView を更新する方法を教えてください。どんな例でも役に立ちます。ありがとう。
コード
private class ViewItem extends Activity{
ImageButton addToCart;
ViewItem(View convertView,final int position)
{
addToCart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
itemPosition=Integer.parseInt(positionView.getText().toString());
int qty = Integer.parseInt(quantity.getText().toString());
ShoppingCartHelper.setQuantity(itemPosition, qty);
ShoppingCartHelper.itemsInTheCart = ShoppingCartHelper.cartMap.size();
Toast.makeText(v.getContext(), "Successfully, Item added to the Cart...", Toast.LENGTH_SHORT).show();
//I need to update a TextView here
// Close the activity
finish();
}
});