2

I am trying to color the date selected in my calendarview. I have tried

String todayDate = (mDay + "/" + mMonth + "/" + mYear);

Toast.makeText(this, "TODAYS DATE" + todayDate, LENGTH_SHORT).show();

Cursor cursor = myDatabase.rawQuery("select * from " + Calms.DATABASE_FLARE_TABLE, null);

//calendarView.setDateTextAppearance(Integer.parseInt("@+color/orange"));

for(int count=1; count<=cursor.getCount(); count++)
{
    cursor.moveToNext();
    String savedDate = cursor.getString(2);

    //calendarView.setDateTextAppearance(getResources().getColor(R.color.orange));
    //calendarView.setDateTextAppearance(R.color.color);

    Toast.makeText(this, "DATE IN DB: "+ savedDate, LENGTH_SHORT).show();
    Toast.makeText(this, "next", LENGTH_SHORT).show();

    if (savedDate.equals(todayDate))
    {
        Toast.makeText(this, "IN IF!!", LENGTH_SHORT).show();
        //calendarView.setDateTextAppearance(Integer.parseInt("@color/orange"));

        calendarView.setDateTextAppearance(getResources().getColor(R.color.orange));
    }

I have also tried context.getRes.....

Nothing seems to work. The colour of the date never changes.

Would anyone be able to help? Thanks

cokeman19
  • 2,405
  • 1
  • 25
  • 40
user2026576
  • 61
  • 2
  • 2
  • 6
  • Possible duplicate of [Android CalendarView for Showing Events](http://stackoverflow.com/questions/16556254/android-calendarview-for-showing-events) – blahdiblah Nov 06 '13 at 00:28

1 Answers1

-1
setTextColor(Color.GREEN);

this is, what i am using to change my colors. Works with buttons, hope it works for you, too.

Eveli
  • 498
  • 1
  • 6
  • 27
  • 1
    calendarView does not have a .setTextColor() method. It does have .setDateTextApperance() but this will not alter the color – user2026576 Feb 18 '13 at 14:27
  • already took a look here? http://developer.android.com/reference/android/widget/CalendarView.html – Eveli Feb 18 '13 at 14:33
  • I think this is what youre looking for: http://w2davids.wordpress.com/android-simple-calendar/ – Eveli Feb 18 '13 at 14:46
  • thanks for the links but I have followed the android developer site and no luck. I also just want to colour the dates numbers not add a grid cell to it. – user2026576 Feb 18 '13 at 15:11
  • hmmm... seems to be pretty tricky, but i'm on my end now, sry – Eveli Feb 18 '13 at 15:12