我申请了订单。当我标记单选按钮时,它是这样加的,我想让它写正常的数字屏幕输出这样我不想让它这样我想让它收集错误的总和
boolean checked=((RadioButton) view ).isChecked();
switch (view.getId()){
case R.id.rb1:
if (checked)
pizza.setPizza_size_price(15);
break;
case R.id.rb2:
pizza.setPizza_size_price(17);
break;
case R.id.rb3:
pizza.setPizza_size_price(19);
break;
case R.id.rb6:
if (checked)
pizza.setIcecek(3);
break;
case R.id.rb7:
pizza.setIcecek(2);
break;
case R.id.rb8:
pizza.setIcecek(3);
break;
case R.id.rb11:
if (checked)
pizza.setPatates(5);
break;
case R.id.rb12:
pizza.setPatates(6);
break;
case R.id.rb13:
pizza.setPatates(7);
break;
}
total.setText("Toplam Ücret:"+pizza.getPizza_size_price()+pizza.getIcecek()+pizza.getPatates()+"TL");
}
1条答案
按热度按时间zujrkrfu1#
如果你的目标是得到
pizza.getPizza_size_price()
,pizza.getIcecek()
以及pizza.getPatates()
作为输出,必须添加括号:否则,这些数字不会被累加,而只是像这样附加到字符串中
"15.0"+"3.0"+"6.0"
然后变成"15.03.06.0"