我尝试读出所有现有的日历。我从这里尝试了这个例子:
http://developer.android.com/guide/topics/providers/calendar-provider.html
但我收到以下编译错误:方法 getContentResolver() 未定义类型 xxx 有人可以帮帮我吗?
public HashMap<String, String> readCalendar() {
String[] EVENT_PROJECTION = new String[] {
Calendars._ID,
Calendars.OWNER_ACCOUNT,
Calendars.ACCOUNT_NAME,
Calendars.CALENDAR_DISPLAY_NAME
};
String selectionICS = "((" + Calendars.ACCOUNT_NAME + " = ?) AND ("
+ Calendars.ACCOUNT_TYPE + " = ?) AND ("
+ Calendars.OWNER_ACCOUNT + " = ?))";
String[] selectionArgs = new String[] {"VISIBLE=1"}; // or "selected=1" ??
Cursor managedCursor = null;
ContentResolver cr = getContentResolver();
managedCursor = cr.query(calendarUri, EVENT_PROJECTION, selectionICS, selectionArgs, null);selectionICS, selectionArgs, null);
}