本文整理汇总了Java中android.provider.CalendarContract.Calendars.CALENDAR_DISPLAY_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java Calendars.CALENDAR_DISPLAY_NAME属性的具体用法?Java Calendars.CALENDAR_DISPLAY_NAME怎么用?Java Calendars.CALENDAR_DISPLAY_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.CalendarContract.Calendars
的用法示例。
在下文中一共展示了Calendars.CALENDAR_DISPLAY_NAME属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCalendars
public static void addCalendars(Context context, List<CalendarInfo> outCalendars) {
final String primary = "\"primary\"";
final String[] projection = { Calendars._ID, Calendars.CALENDAR_DISPLAY_NAME,
"(" + Calendars.ACCOUNT_NAME + "=" + Calendars.OWNER_ACCOUNT + ") AS " + primary };
final String selection = primary + " = 1";
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(Calendars.CONTENT_URI, projection,
selection, null, null);
if (cursor == null) {
return;
}
while (cursor.moveToNext()) {
final CalendarInfo ci = new CalendarInfo();
ci.name = cursor.getString(1);
ci.userId = context.getUserId();
outCalendars.add(ci);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
示例2: getCalendarCrusor
private static Cursor getCalendarCrusor(Context context)
{
String[] EVENT_PROJECTION = new String[] {
BaseColumns._ID, // 0
Calendars.ACCOUNT_NAME, // 1
Calendars.CALENDAR_DISPLAY_NAME, // 2
Calendars.OWNER_ACCOUNT // 3
};
// String[] EVENT_PROJECTION = new String[] {
// "_id", "name"
// };
// The indices for the projection array above.
Cursor cursor = null;
ContentResolver cr = context.getContentResolver();
Uri uri = Calendars.CONTENT_URI;
String selection = "((" + Calendars.ACCOUNT_NAME + " = ?) AND ("
+ Calendars.ACCOUNT_TYPE + " = ?) AND ("
+ Calendars.OWNER_ACCOUNT + " = ?))";
String[] selectionArgs = new String[] {"com.google"};
// Submit the query and get a Cursor object back.
return cr.query(uri, EVENT_PROJECTION, null, null, null);
}