roomorama / Caldroid

A better calendar for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setTextColorForDate and setBackgroundDrawableForDate methods don't seem to work

anirudhmaddy opened this issue · comments

Below is my code:

   Date netDate = (new Date(timeStamp));
   int colorCode = Color.parseColor("#33b5e5");
   ColorDrawable green = new ColorDrawable(Color.GREEN);

   caldroidFragment.setTextColorForDate(R.color.colorPrimary,netDate);
   caldroidFragment.setBackgroundDrawableForDate(green,netDate);
   caldroidFragment.refreshView();

same to me, did u solve the problem now @anirudhmaddy ?

I was having this problem as well. I then found out that my dateString that I was parsing with SimpleDateFormat was actually not the right format.
Example:
String dateString = 2019-01-08 //I had thought this was actually 01-08-2019
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy")
Date date = sdf.parse(dateString);
After correcting the date format string to yyyy-MM-dd the calendar set the colors properly!!