我在Android API 14之前编写了一个旧应用程序,用于访问我的所有Google日历。我几个月前升级到ICS,并将更改纳入使用API,一切仍然正常。但最近一次ROM闪光导致它再次破裂。
问题是应用程序无法查看除默认Google日历之外的任何日历。以前调用日历内容解析程序将返回所有日历,包括假日日历。
我在API文档中找不到任何可以提示我可能需要做什么的内容。
public static List<dateEvent> readCalendar(Context context, String idString ) {
ContentResolver contentResolver = context.getContentResolver();
final Uri calendar_URI = Calendars.CONTENT_URI;
final Uri dates_URI = Instances.CONTENT_URI;
String selection = "((" + Calendars.ACCOUNT_NAME + " = ?) AND ("
+ Calendars.ACCOUNT_TYPE + " = ?) AND ("
+ Calendars.OWNER_ACCOUNT + " = ?))";
String[] selectionArgs = new String[] {
"myaddress@gmail.com", "com.google", "myaddress@gmail.com"};
cursor = contentResolver.query(calendar_URI,
(new String[] { Calendars._ID,
Calendars.CALENDAR_DISPLAY_NAME,
Calendars.VISIBLE } ),
selection, selectionArgs, null );
List<dateEvent> dateList = new LinkedList<dateEvent>();
while (cursor.moveToNext()) {
final String _id = cursor.getString(0);
final String displayName = cursor.getString(1);
System.out.println("Id: " + _id + " Display Name: " + displayName);
}
}