Android Calendar.
<p>I have a problem with adding entry to the Calendar.I tried a lot of tests but without success.</p>

<p>Source code:</p>

<pre><code> String calName; 
        String calId = null;
        String[] projection = new String[] { "_id", "name" };

        Uri calendars = Uri.parse("content://com.android.calendar/calendars");
        Cursor managedCursor = managedQuery(calendars, projection, "selected=1", null, null);
        ContentValues event = new ContentValues();

        DateFormat date = new SimpleDateFormat("dd/MM/yyyy hh:mm");
        long time = System.currentTimeMillis();
        String StartTime = date.format(time);
        String EndTime = "13/4/2011 15:30";

        Log.d(TAG, "Value of timeStr: " + StartTime);



        if (managedCursor.moveToFirst()) {

            int nameColumn = managedCursor.getColumnIndex("name"); 
            int idColumn = managedCursor.getColumnIndex("_id");

            do{
                calName = managedCursor.getString(nameColumn);
                calId = managedCursor.getString(idColumn);

                event.put("calendar_id", calId);
                event.put("title", "Event Title");
                event.put("description", "Description");
                event.put("eventLocation", "New York");
                event.put("dtstart", StartTime );
                event.put("dtend", EndTime);

                Uri eventsUri = Uri.parse("content://com.android.calendar/events");
                Uri calUri = getContentResolver().insert(eventsUri, event);
            }
            while (managedCursor.moveToNext());
            }
              }
}
</code></pre>

<p>Errors:</p>

<pre><code>04-11 20:37:27.965: ERROR/ContentValues(262): Cannot parse Long value for 11/04/2011 08:37 at key dtstart
04-11 20:37:27.995: ERROR/DatabaseUtils(262): Writing exception to parcel
04-11 20:37:27.995: ERROR/DatabaseUtils(262): java.lang.NullPointerException
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at com.android.providers.calendar.CalendarProvider2.calculateLastDate(CalendarProvider2.java:2433)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at com.android.providers.calendar.CalendarProvider2.updateLastDate(CalendarProvider2.java:2502)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at com.android.providers.calendar.CalendarProvider2.insertInTransaction(CalendarProvider2.java:1792)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at com.android.providers.calendar.SQLiteContentProvider.insert(SQLiteContentProvider.java:90)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:180)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:175)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at android.os.Binder.execTransact(Binder.java:288)
04-11 20:37:27.995: ERROR/DatabaseUtils(262):     at dalvik.system.NativeStart.run(Native Method)
</code></pre>
