2011-08-23 23 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

あなたにもputextra(「開始時間」)の前にセット(年、月、日、のHOUR_OF_DAY、minofday)メソッドでカレンダーインスタンスを使用することができます。

関連する問題