2011-08-23 27 views

回答

4

做這樣的事情。這裏startDate是你想要開始的時間。

long startTime,endTime; 

    String startDate = "2011-09-01"; 
    try { 
     Date date = new SimpleDateFormat("yyyy-MM-dd").parse(startDate); 
     startTime=date.getTime(); 
    } 
    catch(Exception e){ } 

    Calendar cal = Calendar.getInstance(); 
    Intent intent = new Intent(Intent.ACTION_EDIT); 
    intent.setType("vnd.android.cursor.item/event"); 
    intent.putExtra("beginTime",startTime); 
    intent.putExtra("allDay", true); 
    intent.putExtra("rrule", "FREQ=YEARLY"); 
    intent.putExtra("endTime", endTime); 
    intent.putExtra("title", "A Test Event from android app"); 
    startActivity(intent); 
+0

我如何添加一個URI到日曆事件..請幫助,我想從日曆事件啓動我的應用程序.. –

1

您可以和使用的日曆實例與設定(年,月,日,HOUROFDAY,minofday)方法putextra( 「BEGINTIME」)之前;

相關問題