当前位置: 首页>>代码示例>>Java>>正文


Java Calendars.CALENDAR_DISPLAY_NAME属性代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:24,代码来源:ZenModeEventRuleSettings.java

示例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);
		
		
		
	}
 
开发者ID:marbergq,项目名称:Multiplanner,代码行数:29,代码来源:ShareModel.java


注:本文中的android.provider.CalendarContract.Calendars.CALENDAR_DISPLAY_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。