public void onRadioButtonClicked(View view) { // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); // Check which radio button was clicked switch (view.getId()) { case R.id.sizes: if (checked) myProduct.setSize("S"); break; case R.id.sizem: if (checked) myProduct.setSize("M"); break; case R.id.sizel: if (checked) myProduct.setSize("L"); break; case R.id.sizexl: if (checked) myProduct.setSize("XL"); break; case R.id.sizexxl: if (checked) myProduct.setSize("XXL"); break; case R.id.cotton: if (checked) myProduct.setMaterial("纯棉"); break; case R.id.fiber: if (checked) myProduct.setMaterial("化纤"); break; case R.id.acrylicfibres: if (checked) myProduct.setMaterial("晴纶"); break; } }
public void onMinusButtonClicked(View view) { if (productCount == 1) return; productCount--; productNum.setText(productCount + ""); myProduct.setQuantity(productCount); }
public void onAddButtonClicked(View view) { productCount++; productNum.setText(productCount + ""); myProduct.setQuantity(productCount); }