I have been trying to get the ID of the Google Calendar installed on my device with this code:
String[] projection =
new String[]{
Calendars._ID,
Calendars.NAME,
Calendars.ACCOUNT_NAME,
Calendars.ACCOUNT_TYPE};
Cursor calCursor =
getContentResolver().
query(Calendars.CONTENT_URI,
projection,
Calendars.VISIBLE + " = 1 ",
null,
Calendars._ID + " ASC");
if (calCursor.moveToFirst()) {
do {
long id = calCursor.getLong(0);
String displayName = calCursor.getString(1);
// ...
textView1.setText(displayName + id); //outputs display name and id
} while (calCursor.moveToNext());
But it is only returning the Name and ID of the Samsung Calendar. Can any one explain to me why?? Thank you.