public void validateAmount(String amount) { if ("".equals(amount) || ".".equals(amount)) { ShowToast.Short("请输入正确的金额格式!"); return; } if (amount.startsWith(".")) { amount = "0" + amount; } if (amount.endsWith(".")) { amount = amount.substring(0, amount.length() - 1); } if (amount.indexOf(".") + 2 < amount.length() - 1) { amount = amount.substring(0, amount.indexOf(".") + 3); } if (Double.parseDouble(amount) <= 0) { ShowToast.Short("请输入 大于等于0.01的金额!"); return; } mIBalanceRechargeView.validateFinish(amount); }
@Override public void onError(String msg) { ShowToast.Short(msg); }