SENTHIL SARAVANAN
SENTHIL SARAVANAN

Reputation: 749

How to add color for android calendar events?

I want to add color for android calendar events, i have used the following code

ContentResolver cr = context.getContentResolver();
ContentValues values = new ContentValues();
values.put(Events.DTSTART, startMillis);
values.put(Events.DTEND, endMillis);
values.put(Events.TITLE, phNumber);
values.put(Events.DISPLAY_COLOR, 0xffff0000);
values.put(Events.CALENDAR_ID, calID);
values.put(Events.EVENT_TIMEZONE, "UTC");
Uri uri = cr.insert(Events.CONTENT_URI, values);

But this code is not added color for event. Even i'm not able to add event in calendar when i use values.put(Events.DISPLAY_COLOR, 0xffff0000) code. How can i implement Events.DISPLAY_COLOR?

Upvotes: 1

Views: 2476

Answers (2)

user3659746
user3659746

Reputation: 17

I reached the goal by:

event.put("eventColor", 0xffff0000);

Upvotes: 0

Jitendar M
Jitendar M

Reputation: 643

Try using Events.EVENT_COLOR instead of Events.DISPLAY_COLOR

As a reference, you can use this link to work with Calendars

Upvotes: 2

Related Questions