Android 2.2-为什么我看不到我添加到日历中的事件?

Android 2.2-为什么我看不到我添加到日历中的事件?,android,Android,我是android开发世界的新手。我想将一个事件添加到我的本机日历中,我可以成功地看到该操作,但是当我转到日历时,我看不到该操作。我的密码在下面 字符串[]投影=新字符串[]{“\u id”,“name”}; Uri日历=Uri.parse(“content://com.android.calendar/calendars"); 我使用摩托罗拉的单元。有人能指出我失败的原因吗?非常感谢。我在自己的项目中使用了以下ContentValues并取得了成功: ContentVa

我是android开发世界的新手。我想将一个事件添加到我的本机日历中,我可以成功地看到该操作,但是当我转到日历时,我看不到该操作。我的密码在下面

字符串[]投影=新字符串[]{“\u id”,“name”}; Uri日历=Uri.parse(“content://com.android.calendar/calendars");


我使用摩托罗拉的单元。有人能指出我失败的原因吗?非常感谢。

我在自己的项目中使用了以下ContentValues并取得了成功:

            ContentValues cv = new ContentValues();
            cv.put("calendar_id", calendarid);          
            cv.put("title", "sometitle");
            cv.put("dtstart", ""+calendarfrom.getTimeInMillis());
            cv.put("dtend", ""+calendarto.getTimeInMillis());
            cv.put("hasAlarm", 0);

            Uri newevent = getContentResolver().insert(Uri.parse("content://calendar/events"), cv); 

我怀疑是您提供的某个ContentValue导致了失败。先试试我的简化示例。

谢谢,我找到了根本原因。这是我的时间设置格式。现在,它起作用了。
            ContentValues cv = new ContentValues();
            cv.put("calendar_id", calendarid);          
            cv.put("title", "sometitle");
            cv.put("dtstart", ""+calendarfrom.getTimeInMillis());
            cv.put("dtend", ""+calendarto.getTimeInMillis());
            cv.put("hasAlarm", 0);

            Uri newevent = getContentResolver().insert(Uri.parse("content://calendar/events"), cv);