gpt4 book ai didi

黑莓 - 如何创建闹钟事件?

转载 作者:行者123 更新时间:2023-12-03 03:46:14 27 4
gpt4 key购买 nike

我想访问闹钟。在我的应用程序中,我已成功访问日历并设置了约会,但我如何访问闹钟。请帮我。以下是我的代码

public class Alarm 
{
private Event event;
public void myAlarm()
{
try
{
EventList eventList = (EventList)PIM.getInstance().
openPIMList(PIM.EVENT_LIST, PIM.WRITE_ONLY);
event = eventList.createEvent();
event.addString(event.SUMMARY, PIMItem.ATTR_NONE, "My alarm");
event.addString(event.LOCATION, PIMItem.ATTR_NONE, "My Location");
event.addDate(event.END, PIMItem.ATTR_NONE,
System.currentTimeMillis()+360000);
event.addDate(event.START, PIMItem.ATTR_NONE,
System.currentTimeMillis()+120000);
event.commit();
}//end of try block
catch(Exception e){}
}//end of method myAlarm
}//end of main class Alarm

最佳答案

EventList evList = (EventList) PIM.getInstance().openPIMList(PIM.EVENT_LIST,
PIM.READ_WRITE);
BlackBerryEvent ev = (BlackBerryEvent) evList.createEvent();

if (evList.isSupportedField(BlackBerryEvent.ALARM)) {
ev.addInt(BlackBerryEvent.ALARM, BlackBerryEvent.ATTR_NONE, 180); //3 min = 180
//if this field has a value of 180, then the alarm first occurs 180 seconds before the
date/time value specified by Event.START
}

关于黑莓 - 如何创建闹钟事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2195557/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com