如何找出我的日历意图的结果? [英] How can I find out the result of my calendar intent?

查看:70
本文介绍了如何找出我的日历意图的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的应用程序中,我打算启动日历:

From my app I am launching the calendar with an intent:

    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", true);
    intent.putExtra("rrule", "FREQ=YEARLY");
    intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
    intent.putExtra("title", "Some title");
    startActivity(intent);

如果用户继续并保存此预先填充的日历项,我无法弄清楚如何获取eventID.我还想知道用户是否取消了日历提示,并且没有保存此新的预填充事件.

I cannot figure out how to get the eventID back if the user goes ahead and saves this pre-populated calendar entry. I also want to know if the user cancelled the calendar prompt, and did not save this new pre-populated event.

是否有任何相关信息返回给onActivityResult(...),可以用作对日历事件的引用?我需要这样做,以便以后可以找到/打开日历事件以进行查看/编辑. [更新:]是的,尝试过onActivityResult(...),一旦日历在用户进行任何交互之前打开,意图就会立即返回,所以这是没有用的.

Is there anything relevant returned to onActivityResult(...) which I could use as a reference to the calendar event? I need this, so I can later find/open the calendar event for viewing/editing. [Update:] Yea, tried onActivityResult(...), and the intent returns as soon as the calendar opens before any user interaction, so this is no use.

我想通过使用意图切换到日历应用程序来执行此操作(也可以让用户从设备上可用的各种日历中进行选择),并避免从我的应用程序重新创建日历UE.我也想至少支持Android 2.2 +.

I would like to do this by handing off to the calendar application by using an intent(also to let the user select from the various calendars available on the device) and avoid recreating the calendar UE from my app. Also I would like to support Android 2.2+ at the very least.

推荐答案

我认为您可以通过onResume方法中的beginTime检查事件.绝对不会有两个具有相同beginTime的事件.

I think you can check event by beginTime in onResume method. There definitely won't be 2 events with the same beginTime.

这篇关于如何找出我的日历意图的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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