有许多关于如何在android中创建新日历事件的示例,但没有关于如何打开和显示事件的示例.到目前为止这是我的代码
public static void startCalendarMimeType(Context context, CalendarItem item){
//all version of android
Intent i = new Intent();
// mimeType will popup the chooser any for any implementing application (e.g. the built in calendar or applications such as "Business calendar"
i.setType("vnd.android.cursor.item/event");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// the time the event should start in millis. This example uses now as the start time and ends in 1 hour
//i.putExtra("beginTime", item.getBegin());
//i.putExtra("endTime", item.getEnd());
i.putExtra("_id", item.getId());
// the action
//i.setAction(Intent.ACTION_PICK);
context.startActivity(i);
}
Run Code Online (Sandbox Code Playgroud)
日历项目包含使用内容解析程序从日历中检索到的信息.当用户点击我的项目时,我希望它打开显示该项目的Android日历.
此时您可以选择要打开的应用程序,如果您选择"显示事件",它会打开日历应用程序,但会获得一个nullpointer异常,而我无法弄清楚我在这里做错了什么.我是第一个尝试这样做的人吗?
任何帮助非常感谢
尝试使用DateTime对象输出完整的月份名称但不知何故我不是在这里显示 interpet 文档.
我希望日期输出的日期如2012年11月18日,但我没有成功
$date = new DateTime();
$datum = $date->format("d m Y");
Run Code Online (Sandbox Code Playgroud)
输出18 11 2012 ??
阅读这种格式dd ([ \t.-])* m ([ \t.-])* y应输出正确,但这根本不起作用?