I have this CalendarView below

and if i click that day which is the Date today it will popup a dialog.. but this Calendar wont popup if u clicked a date before the CurrentDate it will just say u can’t add event before the current day/time.. and is running well if i click any day after the date today, but when i click the date today i will say a message just like when i click the date before it…
Here is my Code for comparing dates
long currentTime;
Date curr = new Date();
currentTime = curr.getTime();
if(cw.getDate() >= currentTime || formatDate(cw.getDate()) == formatDate(currentTime))
{
Dialog d = new Dialog(ScheduleActivity.this);
//some code for setting up the dialog
d.show();
}
else
{
Toast toast = Toast.makeText(ScheduleActivity.this, Long.toString(cw.getDate())+" || "+Long.toString(currentTime),10000);
toast.show();
Log.d("timecheck", formatDate(cw.getDate())+" || "+ formatDate(currentTime));
}
I just used that formatDate with a Format of MM/dd/yyyy just to compare the two dates cuz comparing the time stamp alone still does not work (using “>=” )
Btw the toast are changed so i can see what values are being compared… in Milliseconds they are defferent really but when i format it to MM/dd/yy supposed to be it will see it as the same… but it wont go through the if part it’ll go to the else part.. i Logged the formattedDate in the logcat, logcat below..
Logcat Logs

You will need to use
equalsinstead of==to compare the strings returned from formatDate: