小编use*_*296的帖子

如何在活动中添加Google日历中的活动?

我尝试使用内容提供商,但事件未添加到日历中.

final ContentResolver cr = ctx.getContentResolver();

ContentValues cv = new ContentValues();    
cv.put("calendar_id", l_calId);    
cv.put("title", title);    
cv.put("description", description);    
cv.put("dtstart", millis1 );    
cv.put("hasAlarm", 1);   
cv.put("dtend", millis2);    
cv.put("eventLocation", "Hall: "+location);    
cv.put("transparency", 1);    
cv.put("hasAlarm", 1);    


Uri newEvent ;    
if (Integer.parseInt(Build.VERSION.SDK) == 8 )    
    newEvent = cr.insert(Uri.parse("content://com.android.calendar/events"), cv);    
else    
    newEvent = cr.insert(Uri.parse("content://com.android.calendar/events"), cv);
Run Code Online (Sandbox Code Playgroud)

events android google-calendar-api

11
推荐指数
1
解决办法
8040
查看次数

标签 统计

android ×1

events ×1

google-calendar-api ×1