使用意图编辑日历事件不起作用 [英] Using an intent to edit calendar event doesn't work

查看:224
本文介绍了使用意图编辑日历事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我非常精确地阅读文档: http://开发人员。 android.com/guide/topics/providers/calendar-provider.html#update-event 及其类似的内容:

  //这是一个为指定事件设置新标题的意图的示例,并允许用户在日历中编辑该事件。 

long eventID = 208;
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI,eventID);
Intent intent = new Intent(Intent.ACTION_EDIT)
.setData(uri)
.putExtra(Events.TITLE,My New Title);
startActivity(intent);

对我来说,它不起作用 - 它打开正确的事件,但不可编辑它 - 所有字段都是只读的。只有字段我可以改变是时区和提醒。其他一切都是只读的。我做错了什么?



我的API级别是14(ICS)

解决方案

所以我不认为你做错了 - 我通过命令行组合了同样的事情的基本实现,同样的限制适用:

  am start -a android.intent.action.EDIT --es标题新标题内容://com.android.calendar/events/1 

我只能编辑你所使用的相同字段 - 你最好做一个 ACTION_VIEW 并让用户决定编辑(对不起,我没有一个更好的答案,这很烦人)


Ok, I read docs very precisely here: http://developer.android.com/guide/topics/providers/calendar-provider.html#update-event and its written something like this:

// Here is an example of an intent that sets a new title for a specified event and lets users edit the event in the Calendar.

long eventID = 208;
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
Intent intent = new Intent(Intent.ACTION_EDIT)
    .setData(uri)
    .putExtra(Events.TITLE, "My New Title");
startActivity(intent);

For me it doesn't work - it opens correct event, but it's NOT POSSIBLE to edit it - all fields are read only. Only fields what I can change are Timezone, and Reminder. Everything other is read only. Am I doing something wrong?

My API level is 14 (ICS)

解决方案

So I don't think you're doing anything wrong - I put together a basic implementation of the same thing via command line and the same restriction applies:

am start -a android.intent.action.EDIT --es title "New Title" content://com.android.calendar/events/1

I'm only able to edit the same fields you are - You might be better off doing a ACTION_VIEW and letting the user decide to edit (sorry I don't have a better answer for you, that's kind of annoying)

这篇关于使用意图编辑日历事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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