如何使用if
进行TextView
声明,其中包含除
month_name + " " + today + ", " + thisYear
?
这是我的代码无法正常工作的一部分:
int today = calendar.get(Calendar.DAY_OF_MONTH);
datum2.setText(month_name + " " + today + ", " + thisYear);
if(today == 1 & datum.getText().toString() != (month_name + " " + today + ", " + thisYear))
{
hiddenBonus.setText("0");
hiddenCelkovo.setText("0");
}
谢谢。
答案 0 :(得分:1)
你必须使用equals-方法:
if(today == 1 && !datum.getText().equals(month_name + " " + today + ", " + thisYear)){