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


Java Calendars.ACCOUNT_NAME属性代码示例

本文整理汇总了Java中android.provider.CalendarContract.Calendars.ACCOUNT_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java Calendars.ACCOUNT_NAME属性的具体用法?Java Calendars.ACCOUNT_NAME怎么用?Java Calendars.ACCOUNT_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.CalendarContract.Calendars的用法示例。


在下文中一共展示了Calendars.ACCOUNT_NAME属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getCalendarId

private long getCalendarId() {
  String[] projection = new String[]{Calendars._ID};
  //String selection = Calendars.ACCOUNT_NAME + "=Biermacht AND" + Calendars.ACCOUNT_TYPE + "=" + CalendarContract.ACCOUNT_TYPE_LOCAL;

  String selection = "(" + Calendars.ACCOUNT_NAME + " = ?) AND (" + Calendars.ACCOUNT_TYPE + " = ?)";
  String[] selectionArgs = new String[]{"Biermacht", CalendarContract.ACCOUNT_TYPE_LOCAL};

  // use the same values as above:
  //String[] selArgs = new String[]{"Biermacht", CalendarContract.ACCOUNT_TYPE_LOCAL};
  Cursor cursor = c.getContentResolver().query(Calendars.CONTENT_URI,
                                               projection,
                                               selection,
                                               selectionArgs,
                                               null);
  if (cursor.moveToFirst()) {
    return cursor.getLong(0);
  }
  return - 1;
}
 
开发者ID:caseydavenport,项目名称:biermacht,代码行数:19,代码来源:BrewTimerStepFragment.java

示例3: populateCalendars

public void populateCalendars() {
    String[] projection = new String[]{Calendars._ID, Calendars.NAME,
            Calendars.ACCOUNT_NAME, Calendars.ACCOUNT_TYPE};
    Cursor calCursor = this
            .getActivity()
            .getContentResolver()
            .query(Calendars.CONTENT_URI, projection, null, null,
                    Calendars._ID + " DESC");
    calendarNames = new ArrayList<String>();
    calendarAccounts = new ArrayList<String>();
    calendarTypes = new ArrayList<String>();
    calendarIds = new ArrayList<Long>();
    if (calCursor.moveToFirst()) {
        do {
            String name = calCursor.getString(1);
            if (name == null) {
                name = "Sin nombre";
            }
            calendarNames.add(name);
            calendarAccounts.add(calCursor.getString(2));
            calendarTypes.add(calCursor.getString(3));
            calendarIds.add(calCursor.getLong(0));

        } while (calCursor.moveToNext());
    }
}
 
开发者ID:tuxskar,项目名称:caluma,代码行数:26,代码来源:HomeActivity.java

示例4: populateCalendars

public void populateCalendars() {
    String[] projection = new String[]{Calendars._ID, Calendars.NAME,
            Calendars.ACCOUNT_NAME, Calendars.ACCOUNT_TYPE};
    Cursor calCursor = this.getActivity().getContentResolver()
            .query(Calendars.CONTENT_URI, projection,
                    null, null, Calendars._ID + " DESC");
    calendarNames = new ArrayList<String>();
    calendarAccounts = new ArrayList<String>();
    calendarTypes = new ArrayList<String>();
    calendarIds = new ArrayList<Long>();
    if (calCursor.moveToFirst()) {
        do {
            String name = calCursor.getString(1);
            if (name == null) {
                name = "Sin nombre";
            }
            calendarNames.add(name);
            calendarAccounts.add(calCursor.getString(2));
            calendarTypes.add(calCursor.getString(3));
            calendarIds.add(calCursor.getLong(0));

        } while (calCursor.moveToNext());
    }
}
 
开发者ID:tuxskar,项目名称:caluma,代码行数:24,代码来源:StudentHomeActivity.java

示例5: 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

示例6: queryCalendar

public void queryCalendar(View view) {
	// Run query
	Cursor cur = null;
	ContentResolver cr = getContentResolver();
	Uri uri = Calendars.CONTENT_URI;
	String selection = "((" + Calendars.ACCOUNT_NAME + " = ?) AND ("
			+ Calendars.ACCOUNT_TYPE + " = ?))";

	// Replace this with your own user and account type
	String[] selectionArgs = new String[] { "[email protected]",
			"com.google" };
	// Submit the query and get a Cursor object back.
	cur = cr.query(uri, EVENT_PROJECTION, selection, selectionArgs, null);
	Toast.makeText(this, String.valueOf(cur.getCount()), Toast.LENGTH_LONG)
			.show();
	// Use the cursor to step through the returned records
	while (cur.moveToNext()) {
		long calID = 0;
		String displayName = null;
		String accountName = null;

		// Get the field values
		calID = cur.getLong(PROJECTION_ID_INDEX);
		displayName = cur.getString(PROJECTION_DISPLAY_NAME_INDEX);
		accountName = cur.getString(PROJECTION_ACCOUNT_NAME_INDEX);

		// Do something with the values...
		Toast.makeText(this, "Calendar " + displayName, Toast.LENGTH_SHORT)
				.show();
	}
}
 
开发者ID:vogellacompany,项目名称:codeexamples-android,代码行数:31,代码来源:MyCalendarActivity.java

示例7: getCalendarId

/**
 * returns the CalendarID depending on the account.name and acount.type
 * 
 * @param mContext
 * @param account
 * @return id
 */
public long getCalendarId(Account account) {

	Cursor cur = null;

	long calendarId = -1;

	ContentResolver cr = mContext.getContentResolver();

	String[] projection = new String[] { Calendars._ID };
	String selection = "((" + Calendars.ACCOUNT_NAME + " = ?)  AND (" + Calendars.ACCOUNT_TYPE + " = ?) )";
	String[] selectionArgs = new String[] { account.name, account.type };

	cur = cr.query(Calendars.CONTENT_URI, projection, selection, selectionArgs, null);

	if (cur.getCount() == 1 && cur.moveToFirst()) {
		calendarId = cur.getLong(0);

	} else {
		Log.e(TAG, "getCalendarId() FATAL ERROR cur.getCount()=" + cur.getCount());
	}

	cur.close();
	return calendarId;
}
 
开发者ID:DHBWLoerrach,项目名称:campus-app,代码行数:31,代码来源:CalendarManager.java


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