예제 #1
0
  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;
    }
  }
예제 #2
0
 public void onMinusButtonClicked(View view) {
   if (productCount == 1) return;
   productCount--;
   productNum.setText(productCount + "");
   myProduct.setQuantity(productCount);
 }
예제 #3
0
 public void onAddButtonClicked(View view) {
   productCount++;
   productNum.setText(productCount + "");
   myProduct.setQuantity(productCount);
 }