Android应用开发中的java条件弹出消息
首先,我对Android Studio和Android应用程序开发非常陌生。我想在我的应用程序中显示一个条件弹出窗口,只有当条件不满足时才会弹出
Double billAmount = new Double(etBillAmount.getText().toString());
Double TipPercentage = new Double(etTipPercentage.getText().toString());
// The popup should be given when the Tip percentage is greater than 100 or else continue with
the code
if (TipPercentage > 100)
{
System.out.println("Please enter Tip Percentage between 0 to 100. Thank you");
System.exit(0);
}
Double totalBill;
Double totalTip;
totalTip = TipPercentage*billAmount/100;
totalBill = totalTip + billAmount;
tvTotal.setText("$ " + totalTip.toString());
tvTip.setText("$ " + totalBill.toString());
这是代码,我想在if语句中的条件不满足时弹出一条消息。如果可能的话,请帮助我以线性布局的形式计算出来
请帮我提前感谢大家:):):):)
# 1 楼答案