android how to create event with google account you want?
<p>i want to create a calendar event in my application, here is the code</p>

<pre><code>public class GoogleCalendarsActivity extends Activity {
/** Called when the activity is first created. */

private static final String ACCOUNT_NAME = "xxx@gmail.com";
private static final String INT_NAME_PREFIX = "priv";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Calendar calendar = new GregorianCalendar(2012, 6, 19);
    addCalendar(calendar, this.getContentResolver());
}

private static Uri buildCalUri() {
    return CalendarContract.Events.CONTENT_URI
            .buildUpon()

.appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER,
                    "true")
            .appendQueryParameter(Calendars.ACCOUNT_NAME, ACCOUNT_NAME)
            .appendQueryParameter(Calendars.OWNER_ACCOUNT, ACCOUNT_NAME)
            .appendQueryParameter(Calendars.ACCOUNT_TYPE,"com.google").build();
}

private static ContentValues buildContentValues(Calendar calendar) {
    final ContentValues cv = new ContentValues();
    cv.put("calendar_id", 1);
    cv.put(Events.TITLE, "testing");
    cv.put(Events.DTSTART, System.currentTimeMillis());
    cv.put(Events.DTEND, System.currentTimeMillis());
    cv.put(Events.EVENT_TIMEZONE, "Asia/Taipei");
    return cv;
}

public static void addCalendar(Calendar calendar, ContentResolver cr) {
    if (calendar == null)
        throw new IllegalArgumentException();

    final ContentValues cv = buildContentValues(calendar);

    Uri calUri = buildCalUri();
    cr.insert(calUri, cv);
}

}
</code></pre>

<p>this will work find if xxx@gmail.com is 1st add account in my phone, now i got add second account yyy@gmail.com and i change ACCOUNT_NAME to yyy@gmail.com and try to created event, the event still show that this event is created by xxx, and will not appear in yyy calendar.</p>

<p>i also try change </p>

<pre><code>CalendarContract.Events.CONTENT_UR 
</code></pre>

<p>to </p>

<pre><code>CalendarContract.Calendars.CONTENT_UR 
</code></pre>

<p>and will get error, is that got anyway can create event with account i want?</p>
