I need to be able to create an event in the Google Calendar from my Android app. I believe there is a Calendar API but I have never used it. I'm fairly new to Android development so I've found a few examples from browsing earlier and used the following code to try to update my Android Calendar.
public static boolean updateCalendar(Context context,String cal_Id,String eventId)
{
try{
    Uri CALENDAR_URI = Uri.parse(CAL_URI+"events");
    Cursor c = context.getContentResolver().query(CALENDAR_URI, null, null, null, null);
    String[] s = c.getColumnNames();
    if (c.moveToFirst())
    {
            while (c.moveToNext())
        {
            String _id = c.getString(c.getColumnIndex("_id"));
            String CalId = c.getString(c.getColumnIndex("calendar_id"));            
            if ((_id==null) && (CalId == null))
            {
                             return false;
            }
            else
            {
                if (_id.equals(eventId) && CalId.equals(cal_Id))
                             {
                    Uri uri = ContentUris.withAppendedId(CALENDAR_URI, Integer.parseInt(_id));
                    context.getContentResolver().update(uri, null, null, null);// need to give your data here
                    return true;
                }
            }
        }
    }
}
finally
{
    return true;
}
} 
However when I run it the getColumnNames doesn't get called and the code jumps straight to the line context.getContentResolver().update(uri, null, null, null); and then exits.
I put a couple of test events in my Calendar, why is the code not picking them up?