Reputation: 7973
I am trying to get the calendar events, I used the code below,
public static ArrayList<CalendarEvents>calendarEvents;
calendarEvents = new ArrayList<CalendarEvents>();
String[] projection = new String[] { "calendar_id", "title", "description","dtstart", "dtend","organizer", "eventLocation"};
Cursor cursor = context.getContentResolver()
.query(
Uri.parse("content://com.android.calendar/events"),projection
, null,
null, null);
The result getting all the evnets including birthdays, hloydays,etc... I want to filter user created events.
Upvotes: 0
Views: 526
Reputation: 2354
To filter your events. You must have some unique constraint. Let say in my case, my title contains some significant letters. So i had compared it by title. You can also compare by Events.EVENT_COLOR
Uri eventUri = Events.CONTENT_URI;
int result = 0;
String projection[] = {Events._ID, Events.TITLE};
Cursor cursor = mContext.getApplicationContext()
.getContentResolver().query(eventUri,
projection,
Events.TITLE + " = ? ",
new String[]{title},
null);
Upvotes: 1