Test Calendar API via Device


I am trying to learn how to create event for device and Google calendar, but I have a trouble testing my code. I understand that CALENDAR API will not work with emulator and the minimum SDK version has to be 14. Unfortunately, my HTC EVO 4G is running API Level 8. Is there an alternative to test my CALENDAR API?

Below is my sample code:

String dtString = “01/20/2014”;
SimpleDateFormat curFormater = new SimpleDateFormat(“dd/MM/yyyy”);
Date dtUntill = null;
try {
dtUntill = curFormater.parse(dtString);
} catch (ParseException e) {
// TODO Auto-generated catch block
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block

ContextWrapper ctx = null;
ContentResolver cr = ctx.getContentResolver();
ContentValues values = new ContentValues();

values.put(CalendarContract.Events.DTSTART, dtString);
values.put(CalendarContract.Events.TITLE, "Test Calendar by Alex");
values.put(CalendarContract.Events.DESCRIPTION, "This is a test");

TimeZone timeZone = TimeZone.getDefault();
values.put(CalendarContract.Events.EVENT_TIMEZONE, timeZone.getID());

// default calendar
values.put(CalendarContract.Events.CALENDAR_ID, 2);

values.put(CalendarContract.Events.RRULE, "FREQ=DAILY;UNTIL="
	+ dtUntill);
// for one hour
values.put(CalendarContract.Events.DURATION, "+P1H");

values.put(CalendarContract.Events.HAS_ALARM, 1);

// insert event to calendar
Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);

Thank You.