roomorama / Caldroid

A better calendar for Android
Other
1.42k stars 532 forks source link

setTextColorForDate and setBackgroundDrawableForDate methods don't seem to work #461

Open anirudhmaddy opened 7 years ago

anirudhmaddy commented 7 years ago

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();
indraAsLesmana commented 6 years ago

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

Silverlink34 commented 5 years ago

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!!