6

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)

qkx
  • 2,383
  • 5
  • 28
  • 50
  • What is your API level set at & do you have it with Google API's? – jnthnjns Oct 25 '12 at 16:15
  • My phone API level is 14 (and also my app is coded for level 14) & I don't understand second part of your question... – qkx Oct 25 '12 at 20:54
  • When you select the API level for your project you will see two of each level. *Android 4.0 API 14* && *Google API's API 14* – jnthnjns Oct 25 '12 at 20:58
  • @Asok there's no reason for the OP to install the google APIs - they're just broadcasting an intent... – JRaymond Oct 25 '12 at 21:09
  • And you're trying to edit an existing event, not create a new one, correct? It might just be a limitation... – JRaymond Oct 25 '12 at 21:15
  • yes, i'm trying to edit existing event, not creating new one. But I have many problem with calendar, whole api is not ideal... – qkx Oct 27 '12 at 10:06
  • I have filed a bug report: http://code.google.com/p/android/issues/detail?id=39402 – Wolfram Rittmeyer Nov 07 '12 at 23:18

3 Answers3

6

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)

JRaymond
  • 11,625
  • 5
  • 37
  • 40
3

Workaround for this problem: If you use Intent.ACTION_VIEW you'll at least get an activity in which you can hit the Edit button, after which you can edit the title and location and everything else (in the default calendar app anyway).

Divisible by Zero
  • 2,616
  • 28
  • 31
0

You can able edit an event in the only case you are an organizer of this event so in your case, you a not the organizer

GianhTran
  • 3,443
  • 2
  • 22
  • 42