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


Java Calendars.ACCOUNT_TYPE属性代码示例

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


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

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

示例2: deleteCalendar

/**
 * Deletes all Events from the EventsDB and the Calendar from the CalendarDB
 * identified by the _ID and ACCOUNT_TYPE
 * 
 * @param mContext
 * @param account
 * @return true if delete was successful
 */
public boolean deleteCalendar(Account account, long calendarId) {

	deleteAllEvents(account, calendarId);

	ContentResolver cr = mContext.getContentResolver();
	String selection = "((" + Calendars._ID + " = ?) AND  (" + Calendars.ACCOUNT_TYPE + " = ?))";
	String[] selectionArgs = new String[] { Long.toString(calendarId), Constants.ACCOUNT_TYPE };

	long ret = cr.delete(Calendars.CONTENT_URI, selection, selectionArgs);

	if (ret == 1) {
		return true;
	} else if (ret == 0) {
		return false;
	} else {
		Log.w(TAG, "WARNING deleteCalendar() deleted " + ret + " rows, should be only one!");
		return true;
	}

}
 
开发者ID:DHBWLoerrach,项目名称:campus-app,代码行数:28,代码来源:CalendarManager.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: deleteCalendar

/**
 * Deletes all Events from the EventsDB and the Calendar from the CalendarDB
 * identified by the _ID and ACCOUNT_TYPE
 * 
 * @param mContext
 * @param account
 * @return true if delete was successful
 */
public boolean deleteCalendar(Account account, long calendarId) {

	deleteAllEvents(account, calendarId);
	Uri url = asSyncAdapter(Calendars.CONTENT_URI, account.name, account.type);

	ContentResolver cr = mContext.getContentResolver();
	String selection = "((" + Calendars._ID + " = ?) AND  (" + Calendars.ACCOUNT_TYPE + " = ?))";
	String[] selectionArgs = new String[] { Long.toString(calendarId), Constants.ACCOUNT_TYPE };

	long ret = cr.delete(Calendars.CONTENT_URI, selection, selectionArgs);

	if (ret == 1) {
		return true;
	} else if (ret == 0) {
		return false;
	} else {
		Log.w(TAG, "WARNING deleteCalendar() deleted " + ret + " rows, should be only one!");
		return true;
	}

}
 
开发者ID:dan-42,项目名称:DHBWCampusApp,代码行数:29,代码来源:CalendarManager.java

示例6: getCalendars

/**
 * returns all in DB existings CalendarNames filterd by ACCOUNT_TYPE
 * 
 * 
 * @return List of Strings
 */
public ArrayList<String> getCalendars() {

	Cursor cur = null;
	ArrayList<String> cals = new ArrayList<String>();

	ContentResolver cr = mContext.getContentResolver();

	String[] projection = new String[] { Calendars.NAME };
	String selection = "( (" + Calendars.ACCOUNT_TYPE + " = ?) )";
	String[] selectionArgs = new String[] { Constants.ACCOUNT_TYPE };

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

	if (cur.getCount() >= 1 && cur.moveToFirst()) {

		do {
			cals.add(new String(cur.getString(0)));
		} while (cur.moveToNext());

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

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

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

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

示例9: 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_TYPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。