-2

How can i make if statement with TextView which consists of any text except

month_name + " " + today + ", " + thisYear?

This is part of my code which is not working correctly:

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");
    }

Thank you.

PiotrWolkowski
  • 8,408
  • 6
  • 48
  • 68
Kristo258
  • 131
  • 2
  • 9

1 Answers1

1

You have to use equals- method:

if(today == 1 && !datum.getText().equals(month_name + " " + today + ", " + thisYear)){
Jens
  • 67,715
  • 15
  • 98
  • 113