• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to start EditEvent of calendar by CTS code

I can start the calendar and switch it to week/month view, but I cannot add an event by EditEvent. Nothing is shown and done..:confused:


public void testStartup() throws InterruptedException{
Intent main = buildIntent(PACKAGE_UNDER_TEST,ACTIVITY_UNDER_TEST);
Activity mainA = getInstrumentation().startActivitySync(main);

Intent intent = buildIntent("com.android.calendar","EditEvent");
intent.setAction(Intent.ACTION_EDIT);

//set data
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime", System.currentTimeMillis());
intent.putExtra("allDay", true);
intent.putExtra("rrule", "FREQ=YEARLY");
intent.putExtra("endTime", System.currentTimeMillis()+60*60*1000);
intent.putExtra("title", "A Test Event from android app");
//how to start the activity???
mainA.startAcvtivity(Edit);
//getInstrumentation().startActivitySync(Edit);
}
 
Back
Top Bottom