I want to provide the user with a shortcut to creating a new calendar
event, leaving him at whatever Activity would ordinarily be used to do
this (com.android.calendar.EditEvent in Android devices other than the
Hero).

I have code (see below) that works, in a fragile manner, by directly
handing the control to EditEvent, but this does not work on the Hero
devices nor would it be a great means of doing so for users who had a
fancy 3rd party calendar app that they preferred to Android's
Calendar.

How should I consider doing this?
Should I try to just

1.  create an event by directly manipulating the database and then
2.  startActivity(ACTION_EDIT, uri_of_handcrafted_event)?

or should I simply write my own minimal event-view activity to use in
lieu of step 2?

I'm disappointed to see that Calendar provider is considered less
fundamental to the platform that the Contact provider.  Is it likely
to gain ground soon?  I'd really like to see Intents deliver on the
"don't re-invent the wheel" promise I thought inspired them.

    Intent insertCalendarEvent(String title, long begin, long end,
String description) {
        Intent intent = new Intent(Intent.ACTION_INSERT) ;
        intent.setClassName
("com.android.calendar","com.android.calendar.EditEvent");
            intent.putExtra("beginTime", begin);
            intent.putExtra("endTime", end);
            if (title != null)
                intent.putExtra("title", title);
            if (description!= null)
                intent.putExtra("description", description);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            return intent;
    }

Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to