提醒添加到日历 [英] Add reminder to calendar

查看:189
本文介绍了提醒添加到日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我目前使用以下code以添加一个事件到Android的默认日历。

Hi I am currently using the following code to add an event to the android's default calendar.

  Calendar cal = Calendar.getInstance();              
    Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime", cal.getTimeInMillis());
    intent.putExtra("allDay", false);
    intent.putExtra("rrule", "FREQ=DAILY");
    intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
    intent.putExtra("title", "A Test Event from android app");
    intent.putExtra("description", "Who knows! this might work");
intent.putExtra("eventLocation", "Hope this time it works");
  intent.putExtra("hasAlarm", 1);
    startActivity(intent);

我的问题是,
 正如你所看到的,我曾用FREQ = DAILY,同样也有,如,频率= YEARLY和频率=月刊值。
我想知道其他的替代品,这样我可以在我的code提供给他们。

My question is, As you can see, I have used "FREQ=DAILY", and similarly there are values such as, "FREQ=YEARLY" and "FREQ=MONTHLY". I would like to know the other alternatives available, so that I can provide them in my code.

推荐答案

哦。现在我知道了。我不得不将其添加到上述code。

Oh. Now I got it. I had to add this to the above code.

       ContentResolver cr = getContentResolver();
     Uri REMINDERS_URI = Uri.parse(getCalendarUriBase(this) + "reminders");
    values = new ContentValues();
    values.put( "event_id", Long.parseLong(event.getLastPathSegment()));
    values.put( "method", 1 );
    values.put( "minutes", 5 );
    cr.insert( REMINDERS_URI, values );

这篇关于提醒添加到日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆