2011-07-14 6 views
0

実際にデバイスのカレンダーにメモを保存できるアプリを作成しました。メモを書き留めたい場合や、メモを保存したい場合がありますデバイスのカレンダー..すべて正常に動作します。しかし、私は何が欲しい私はデバイスのカレンダーにデバイスのカレンダーから削除されたデータのみが削除されているデータは、私のアプリによって挿入されたデータではなく、誰かによってデバイスカレンダーに既に存在しています.iは、データを削除し、私のアプリから与えられた新しいデータを挿入することを意味します..デバイスカレンダーにデータを保存するために書いたコードを以下に示します。 。この関数が呼び出されると、私は私のアプリから私の以前に保存されたすべてのデータを削除したいと思います。デバイスのカレンダーからデータを削除/更新する方法

public void setAlertOnDevice() 
    { 



      Date dtStartDate = CycleManager.getSingletonObject().getStartDate(); 

      boolean bDeleteAndReturn = false; 

      Calendar cal = Calendar.getInstance(); 

      if (dtStartDate.getTime() == CycleManager.getSingletonObject().getDefaultDate().getTime()) 
      { 
        bDeleteAndReturn = true; 
        dtStartDate = cal.getTime(); 
      } 


      getOffsetsForCycleStages(CycleManager.getSingletonObject().iAvgCycleTime); 
      if(bDeleteAndReturn==false) 
      { 
       if (CycleManager.getSingletonObject().bNextCycleAlert && iStart>0) 
       { 
        cal.setTime(dtStartDate); 
        cal.add(Calendar.DATE, iStart); 

        Uri EVENTS_URI = Uri.parse(getCalendarUriBase(this) + "events"); 
        ContentResolver cr = getContentResolver(); 
        String str="SeeCycles: Start"; 
        String strDescription="Cycle expected today. On start, enter the date into SeeCycles"; 
        ContentValues values = new ContentValues(); 
        values.put("calendar_id", 1); 
        values.put("title", str); 
        values.put("description", strDescription); 
        values.put("dtstart", cal.getTimeInMillis()); 
        values.put("dtend", cal.getTimeInMillis()); 
        cr.insert(EVENTS_URI, values); 
       } 
    } 

答えて

0

ユーザーのGoogleカレンダーを変更する場合は、GoogleカレンダーGData APIを使用してください。

関連する問題