我正在尝试在我的Titanium App for Android平台中创建日历活动。为此我使用下面的代码,它没有给出任何错误也没有创建任何日历事件
var calendars = Ti.Android.Calendar.selectableCalendars;
var names =[];
for (var i = 0; i<calendars.length; i++) {
names.push(calendars[i].name);
}
var calendarDialog = Titanium.UI.createOptionDialog({
title: 'Select a Calendar',
options: names,
cancel:1
});
calendarDialog.addEventListener('click', function(e){
var ci = e.index+1;
var calendar = Ti.Android.Calendar.getCalendarById(ci);
var eventBegins = new Date(2011, 12, 26, 12, 0, 0);
var eventEnds = new Date(2011, 12, 26, 14, 0, 0);
var hasReminder = true;
var details = {
title: 'i m testing',
description: 'message',
begin: eventBegins,
end: eventEnds,
hasAlarm:true,
allDay:true
};
var event = calendar.createEvent(details);
if (hasReminder)
{
var reminderDetails = {
minutes: 10,
method: Ti.Android.Calendar.METHOD_ALERT
};
event.createReminder(reminderDetails);
}
alert('Event was created!');
});
calendarDialog.show();
任何人帮我解决这个问题..我的Titanium SDK版本是1.7.5,我在Android 2.3手机中试过这个
答案 0 :(得分:0)